0

I have created notification bar

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_NO_CLEAR;
((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)).notify(
    Constants.NOTIFICATION_ID, notification);

if device forcefully restart notification still appearing after boot up.

i need to dismiss the notification bar if device restart.

4

1 回答 1

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);
于 2013-10-01T09:44:10.107 回答