0

I am trying to open an activity when user clicks on Notification. I had issued following Intent as pending Intent

Intent caseIntent = new Intent(mContext, LoginActivity.class);
caseIntent.putExtra("priority", priority);
caseIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, caseIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_UPDATE_CURRENT);

But when I click on the notification, if the app is not in forground the active which I have specified is not opening at all. Is something wrong with this Intent?

Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148
Nitin
  • 23
  • 1
  • 4
  • Start by switching from `PendingIntent.FLAG_CANCEL_CURRENT|PendingIntent.FLAG_UPDATE_CURRENT` to `0`. If nothing else, use *one* of those flags, not both, but in this case you should need neither of them. Beyond that, the combination of `FLAG_ACTIVITY_CLEAR_TOP` and `FLAG_ACTIVITY_NEW_TASK` is odd. There are probably [better combinations to use](https://stackoverflow.com/a/29376250/115145). – CommonsWare Jun 13 '15 at 12:04
  • Thanks CommonsWare . It helped a lot Thanks – Nitin Jul 16 '15 at 05:40

0 Answers0