Deep linking and multiple app instances

Solution 1:

You need to do following things for your Activity in your Manifest.

android:launchMode="singleTask"

This tells the system to always launch the existing instance of the Activity if it is already created.

And you can handle the Intent then by overriding the method

onNewIntent 

See http://developer.android.com/guide/topics/manifest/activity-element.html for more information.

Solution 2:

the accepted answer didn't work for me, here is what did:

intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();

from the official doc:

If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent.