Could not cancel the notifications in android
Posted
by
banti
on Stack Overflow
See other posts from Stack Overflow
or by banti
Published on 2012-04-13T05:24:10Z
Indexed on
2012/04/13
5:29 UTC
Read the original article
Hit count: 117
android
|android-notifications
I have the Problem when user press the Notification activity is open but notification can not be close help me
my code is
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int icon = R.drawable.ic_launcher;
CharSequence tickerText = "Good Morning";
long time = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, time);
Context context = getApplicationContext();
CharSequence contentTitle = "Title";
CharSequence contentText = "Text";
Intent notificationIntent = new Intent(this, NotificationManagerDemoActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent,0);
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(1,notification);
© Stack Overflow or respective owner