My app has launch-mode attribute ="singleTop" in the manifest and handles the intent it was launched by with getIntent(). After handling the intent it calls setIntent(new Intent()); to erase the original intent. This avoids the activity handle the same intent if it is created again (for example if orientation change is managed).
I just have problems when the activity gets destroyed when I press the back button: indeed when I tap on its "recent apps" slot the activity is created again and I get the original intent handled again. No original intent if I call the app again from the home screen.
Note that:
- the app has to be visible in the "recent apps" menu;
- the activity can receive further intents (it's "singleTop") and handles them in onNewIntent();
- if the activity gets destroyed it can be started again with an intent; How to erase the original intent from the "recent apps" slot too?