As the static shortcuts will always have FLAG_ACTIVITY_NEW_TASK
and FLAG_ACTIVITY_CLEAR_TASK
set,
I've created TempActivity which is an invisible Activity i.e It'll start MainActivity and then calls finish(). And also as suggested in developer docs SecondActivity has android:taskAffinity=""
in the app's AndroidManifest.xml file.
I have read Manage shortcuts and How to launch an existing instance of activity from static shortcut.
You can see Image A and Image B. There are different opinions.
Where should I add android:taskAffinity when I launch an existing instance of activity from the static shortcut in Android Studio? MainActivity or TempActivity?
Image A
Image B