2013-10-01 80 views
0

我已經建立通知欄通知欄不駁回

通知通知=新通知(logoId, 「ABC」,系統 .currentTimeMillis());

Intent intent = new Intent(context, NewActivity.class); 
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); 
notification.setLatestEventInfo(context, "PQR", "", pendingIntent); 
notification.flags |= Notification.FLAG_NO_CLEAR; 
((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)).notify(
    Constants.NOTIFICATION_ID, notification); 

如果設備強行重啓開機後仍然通知出現。

如果設備重新啓動,我需要關閉通知欄。

回答

0

試試這個

Notification notification = new Notification(logoId, "ABC", System .currentTimeMillis()); 

Intent intent = new Intent(context, NewActivity.class); 
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); 
notification.setLatestEventInfo(context, "PQR", "", pendingIntent); 
notification.flags |= Notification.FLAG_AUTO_CANCEL 
((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)).notify(
    Constants.NOTIFICATION_ID, notification); 
+0

我想這一個..當用戶清除它從通知欄,刪除通知... –

+0

那麼你想要什麼excatly? – Andrain

+0

我不想強制清除用戶的通知。我的問題是這樣的。當用戶重新啓動設備時仍然可以通知托盤中的通知。 –