Observation:
Deep linking can bring the issue of "duelling activities". The concerning condition is deep-linking into an app that uses a multiple activity stack, where the root activity has no content (e.g. using launch activity to enforce an authentication strategy).
Most applications whose main activity uses the "standard" or "singleTop" activity launch mode will have, any time a deep link is clicked, a second instance. That instance of your activity will open in the app that hosts the link. Then there can be two (potentially) full-fledged versions of an app running in two different tasks.
Proposed solution:
Introduce a new activity whose only function is to manage deep links. This allows the launch activity to remain single top. To do so explicitly create a new activity (e.g. .IntentForwardActivity), define the launchMode as "singleTask" and add the intent-filters for deep links (e.g. android:scheme). When the new activity receives a deep-linking intent, it forwards it to your launch activity, and the deep link behaves as expected.
Example:
Notice that this new activity does not contain the launcher-activity intent filter. For this solution to work, it's important to keep your launch activity and deep-link-receiving activity separate. If you have a launch activity that's already "singleTop," you shouldn't have to change it at all.
Because the activity is not created every time (single instance), you'll have to forward the intents from both onCreate() and onNewIntent(). Let's see some sample code:
This solution is simple and effective, and requires no changes of existing app infrastructure.
References: