Reputation: 1287
Just to make it short:
what I need is open an activity, start a countdown, minimize, launch a notification when timer goes to 0 and by tapping the notification go back to the previous state of the activity without creating a new one
what I have is this:
Intent intent = new Intent(ctx, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pIntent = PendingIntent.getActivity(ctx, 0, intent, 0);
It works perfectly for android <4.2 but when runs on Jelly Bean, it opens a new instance of the Activity. It seems that Jelly Bean does not recognize none of the flags Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP
How can I make it run for 4.2+ ?
Upvotes: 0
Views: 223
Reputation: 13721
Just set your activity launch mode as
launchMode="singleTop"
Upvotes: 1