Skip to content Skip to sidebar Skip to footer

Not Working Corss-application Activities With Taskaffinity In Android 11

I have two application, App A and App B, now I want to start an activity in App B from App A, the launchmode of this Activity is “singleTask”. The order: Activity X (App A) —

Solution 1:

You can't. And you shouldn't. The reason it was working before is that taskAffinity was trumping (overriding) the launchMode. Obviously they have changed/fixed that in Android 11.

If an Activity is declared as singleTask then this tells Android that the Activity wants to be the root Activity in its own task. When you launch this Activity, it should be launched in a new task, not into the same task as the Activity doing the launching.

In earlier versions of Android, the Activity would be launched into the same task if the Activity had the sametaskAffinity as the root Activity of the launching task. This was never clearly documented, and so it wasn't clear if this was a "bug" or a "feature". It looks like they have finally changed/fixed this in Android 11.

See my answers to these related questions:

Post a Comment for "Not Working Corss-application Activities With Taskaffinity In Android 11"