I write an activity which I'd like to behave (in terms of instatiating it) similar to command-line tools such as, let's say, sort
(imagine: sort = my_application, pipe "|" = intent_resolution)
In Android world it would be that every intent is processed by my activity, and I still can go back.
Use case is like that:
We have an Activity com.A
.
- User runs it from home screen:
LAUNCHER/MAIN of com.A
(screen Ax appears)
Home button is pressed.
Then user runs A with explicit intent
am -n com/.A -e some_extra
(screen Ay appears - it's different because it depends on intent)
- Home button again.
- User runs A again (third time) from launcher icon:
LAUNCHER/MAIN of com.A
(screen Ay appears, because Android 'thinks' that user wants previous activity. But he'd like to see Ax again - as a proper response for intent LAUNCHER/MAIN)
I can obtain such behaviour by setting launchMode=singleTask
, so my every intent is processed by onCreate
or onNewIntent
. But in such case I lose history. So if A calls B and B calls A (A → B → A) I will lose first A. The same if A calls A (A → A) than I cannot go back.
Is this possible to set such a combination of <activity>
manifest attributes or using other means to obtain that behaviour?
Note: if I change LAUNCHER/MAIN
for any other intent it doesn't change anything.