android中如何清除系统的notification? 50
使用NotificationManager里的cancelAll,但是只有我自己编写的通知被清除了,系统本身的例如未读短信、未接来电之类却依旧存在。求解?...
使用NotificationManager里的cancelAll,但是只有我自己编写的通知被清除了,系统本身的例如未读短信、未接来电之类却依旧存在。求解?
展开
2个回答
2013-06-05
展开全部
Notification notification = new Notification(R.drawable.icon,
"嘎你妹", System.currentTimeMillis());
NotificationManager nm = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Intent ii = new Intent();
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
ii, PendingIntent.FLAG_UPDATE_CURRENT);
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.defaults = Notification.DEFAULT_SOUND;
Intent i = new Intent("com.android.broadcasttest.xxx");//已有广播
notification.deleteIntent = PendingIntent.getBroadcast(this, 0,i, 0);
notification.setLatestEventInfo(context, "嘎嘎消息",
String.format("共%d条新消息", 1), contentIntent);
nm.notify(R.string.app_name, notification);
一个例子,希望楼主采纳。
"嘎你妹", System.currentTimeMillis());
NotificationManager nm = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Intent ii = new Intent();
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
ii, PendingIntent.FLAG_UPDATE_CURRENT);
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.defaults = Notification.DEFAULT_SOUND;
Intent i = new Intent("com.android.broadcasttest.xxx");//已有广播
notification.deleteIntent = PendingIntent.getBroadcast(this, 0,i, 0);
notification.setLatestEventInfo(context, "嘎嘎消息",
String.format("共%d条新消息", 1), contentIntent);
nm.notify(R.string.app_name, notification);
一个例子,希望楼主采纳。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询