我想在通知中添加点击操作(退出(完成))。我正在制作一个包含多个类的简单应用程序,当我点击通知时,我希望它们全部完成。这是我的通知代码:
mMN = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification n = new Notification();
n.icon = R.drawable.ic_launcher;
n.tickerText = "Tap this notification to exit";
n.when = System.currentTimeMillis();
Intent nid = new Intent(MainActivity.this, stopservice.class);
PendingIntent ci = PendingIntent.getActivity(this, 0, nid,PendingIntent.FLAG_UPDATE_CURRENT);
CharSequence ct = "TAP";
CharSequence tt = "Tap here to exit";
n.setLatestEventInfo(this,ct,tt,ci);
mMN.notify(NOTIFICATION_ID, n);
我正在参考stopservice class
(我的停止服务代码) on Intent nid
,但我不太确定它是否是正确的参考。
希望我的问题很清楚。