You need to:
1. In the intent:
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
If you have more then one notification at a time, set the request code uniquely
PendingIntent pendingIntent = PendingIntent.getActivity(this, uniqueIntForName, intent, PendingIntent.FLAG_UPDATE_CURRENT);
This way you will have the correct extras for the specific notification when lunching the
Activity.
2. In the Activity the pending intent is calling:
@Override
public void onNewIntent(Intent newIntent) { Log.i(P.Tag, "===onNewIntent called==="); this.setIntent(newIntent); }
No comments:
Post a Comment