I have an app that allows you to create Home “shortcuts” to a specific Activity. It turns out that some of my users will use the app, hit the home key to go do something else, then use one of the shortcuts to jump back to that Activity. Since the app is still in memory it just opens the new Activity on top of the others and the “Back” key will take them back through the whole history. What I’d like to have happen is if they use a shortcut then to effectively kill the history and have the back key just exit the app. Any suggestions?
I have an app that allows you to create Home shortcuts to a specific
Share
First, set up the taskAffinity in the Manifest to make the
Activityrun as a different “task”:then, when building the shortcut, set the
FLAG_ACTIVITY_NEW_TASKandFLAG_ACTIVITY_CLEAR_TOPflags. Something like: