notifyDetails.setLatestEventInfo(getBaseContext代码不起作用

时间:2019-05-12 10:47:48

标签: java android

大家好,我是android项目的新手,所以现在我不再做更多了。我在这里遇到问题,希望我能在这里得到解决。

我正在制作语音邮件应用程序,但遇到错误,请帮助我如何解决它。

private void notifyUser() {

        NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        final Notification notifyDetails = new Notification(
                R.drawable.phone_receiver, "New Voicemail alert!, Click Me!",
                System.currentTimeMillis());
        notifyDetails.flags = Notification.FLAG_AUTO_CANCEL;
        Intent notificationIntent = new Intent(this,
                AnsweringMachineActivity.class);
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                notificationIntent, 0);
        notifyDetails.setLatestEventInfo(getBaseContext(),
                "you have a message from", file_name, contentIntent);
        final int NOTIFY_ID = 1;
        mNotificationManager.notify(NOTIFY_ID, notifyDetails);

    }

0 个答案:

没有答案