Android-通知管理器,具有无意图的通知
发布于 2021-01-30 17:07:37
我希望能够发出通知,以提醒用户有关计时器已结束的信息,但是,当您单击通知时,我不希望有任何意图。
我已经尝试将null传递给意图
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);
int icon = R.drawable.icon;
CharSequence tickerText = "Hello";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
notification.setLatestEventInfo(context, contentTitle, contentText, null);
mNotificationManager.notify(HELLO_ID, notification);
关注者
0
被浏览
225
1 个回答