How to save multiple actions of the same application in the list of recent applications

I have one application with two actions A and B, both with singleInstance launch mode. I notice that even if both A and B are running in the background, only the last action is displayed in the last list of applications. Can I save both A and B in the list of recent applications? Thanks.

+6
source share
2 answers

In AndroidManifest, be sure to set the android: taskAffinity attribute of the element differently for each action. For example:

<activity
    android:name="com.example.ActivityA"
    android:label="Activity A"
    android:launchMode="singleInstance"
    android:taskAffinity="com.example.AffinityA" >
</activity>
<activity
    android:name="com.example.ActivityB"
    android:label="Activity B"
    android:launchMode="singleInstance"
    android:taskAffinity="com.example.AffinityB" >
</activity>
+7
source

, Intent FLAG_ACTIVITY_NEW_TASK FLAG_ACTIVITY_NEW_TASK.

0

Source: https://habr.com/ru/post/1624882/


All Articles