3

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?

Vidhi Dave
  • 5,614
  • 2
  • 33
  • 55
  • This article explains its pretty well, https://inthecheesefactory.com/blog/understand-android-activity-launchmode/en – niranjan kurambhatti Feb 13 '18 at 05:13
  • @niranjankurambhatti I went through the article earlier. I was asking about the effect that `singleTask` launch mode has in the context of the main launcher activity. I couldn't find anything specific to that in the article – Shubham Rai Feb 13 '18 at 06:07
  • what behaviour do you want? generally, we do not give any launch mode to the starting activity. – niranjan kurambhatti Feb 14 '18 at 19:06
  • Ya that’s what I am doing now. Just that I can’t understand the behaviour of app for singleTask launchMode in main launcher activity – Shubham Rai Feb 15 '18 at 01:58

0 Answers0