The launcher activity of my app is defined with this intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
I specified the launchMode
for this activity as singleTask
.
According to the second answer of this question - Android default launchMode of LAUNCHER activity? it shouldn't make any difference. But in my case every time I minimise the app and then relaunch it using the app icon the LauncherActivity
is being brought to the forefront with intent flags - FLAG_ACTIVITY_NEW_TASK
, FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
and FLAG_ACTIVITY_BROUGHT_TO_FRONT
. This is causing the LauncherActivity
to start on top of the existing task.
While for standard
and singleTop
launch modes there is no problem. The LaunchActivity
is not being instantiated again.
Is this an anomaly or am I somewhere wrong in my understanding?