【发布时间】:2015-09-08 06:40:56
【问题描述】:
我想通过setAutoCancle()方法关闭通知。
这是NotifactionExample的代码。
@SuppressWarnings("deprecation")
protected void notifactionAlert() {
// TODO Auto-generated method stub
NotificationManager myNotifaction = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
@SuppressWarnings("deprecation")
Notification Notifaction = new Notification(R.drawable.notifaction,
"Notifaction received.", System.currentTimeMillis());
Intent notifactionIntent = new Intent(MainActivity.this, notify.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
notifactionIntent, 0);
Notifaction.setLatestEventInfo(MainActivity.this, "Notifaction.",
"you get a new notifaction...", pendingIntent);
myNotifaction.notify(9999, Notifaction);
}
我能做什么?
【问题讨论】:
-
你在stackvoerflow上检查过类似的问题吗stackoverflow.com/questions/16179899/…
-
您想在用户看到之后还是之前删除通知?
-
我想在用户点击通知时取消通知。
标签: java android android-notifications