Skip to content Skip to sidebar Skip to footer

Notification Android Does Not Close After Click

i'm trying create notification jelly bean (api 16) and have get issue with my notification, this my code public class CreateNotification extends AsyncTask

Solution 1:

When you create your resultIntent add the notification id. In your case it is the 0 you defined in mNotificationManager.notify(0, noti); so add it like this:

resultIntent.putExtra("NOTIFICATION_ID", 0);

then you can retrieve that id to cancel the notification on the onCreate of the the activity of your resultPendingIntent like this:

@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    NotificationManagermanager= (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    manager.cancel(getIntent().getIntExtra("NOTIFICATION_ID", -1));
    //todo
}

Post a Comment for "Notification Android Does Not Close After Click"