我需要一个在android上添加通知的程序.当有人点击通知时,它应该引导他们进行第二次活动.
我已经建立了一个代码.通知应该有效,但由于某种原因它无法正常工作.在Notification没有显示的.不知道我错过了什么.
这些文件的代码:
Notification n = new Notification.Builder(this)
.setContentTitle("New mail from " + "test@gmail.com")
.setContentText("Subject")
.setContentIntent(pIntent).setAutoCancel(true)
.setStyle(new Notification.BigTextStyle().bigText(longText))
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// Hide the notification after it's selected
notificationManager.notify(0, n);
Run Code Online (Sandbox Code Playgroud)