Android Notification restarts app but want to resume Android Notification restarts app but want to resume android android

Android Notification restarts app but want to resume


I put this in manifest

android:launchMode="singleInstance"

This fixed the problem for me. Also this answer which I have not tried which allude to other things of interest.


If you have to avoid setting your activity to "singleInstance", then set the notification's intent as follows:

notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);


You can try this FLAG_ACTIVITY_REORDER_TO_FRONT (the document describes exactly what you want to)

http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_REORDER_TO_FRONT

Intent notificationIntent = new Intent(this, HelloAndroid2.class);notificationIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);