0

I want the PendingIntent set to the Notification not to start a new Activity (nor add it to the back stack) if said Activity is already started

I should be missing something cause I tried this Prevent notification PendingIntent starts Activity already started?, Android: new Intent() starts new instance with android:launchMode="singleTop" and Android notification bar open last active activity? but none of them work.

How can this be achieved?

Community
  • 1
  • 1
Christopher Francisco
  • 15,672
  • 28
  • 94
  • 206

1 Answers1

0

android:launchMode="singleTop"

This only stops opening a new instance of the Activity from the same Activity. eg: Trying to open ActivityA from ActivityA.

Something like instance1 of ActivityA -> ActivityB -> instance2 of ActivityA will still work with android:launchMode="singleTop".

Which case are you experimenting?

also try android:launchMode="singleTask" and work on onNewIntent();

Archie.bpgc
  • 23,812
  • 38
  • 150
  • 226