Reputation: 1832
I'm trying to add deep-link to my app, the user does some stuff then the browser launches then getting back to the app by clicking on a button, the problem is that I need to resume the activity and not start it again. I tested the deep link by a script in adb shell and it is working fine but not from the browser.
here is how my code looks like:
<activity
android:name=".activity.MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="me"
android:host="test" />
</intent-filter>
</activity>
adb script:
adb shell am start -W -a android.intent.action.MAIN -d "me://test" com.example.myapp
HTML:
<a href="intent://test/#Intent;scheme=me;action=android.intent.action.MAIN;package=com.example.myapp;end">Back To App</a>
Upvotes: 4
Views: 1128
Reputation: 531
Add a launchMode to this activity with 'singleInstance'
<activity
android:name=".activity.MapsActivity"
android:label="@string/title_activity_maps"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="me"
android:host="test" />
</intent-filter>
Upvotes: 1