Prevent Deeplink from being opened within the browser of the originating app
Asked Answered
S

2

7

I am using Branch.io to Deeplink from the Salesforce App to my Cordova app. However, when I click the deeplink in the Salesforce app, it just opens my app within a browser inside the Salesforce app instead of actually taking me to my app. It seems like I should be using a <intent-filter/> to make that happen but it doesn't seem to be able to take me out of the originating Salesforce app. Here is what my <intent-filter/> currently is:

 <intent-filter android:name="io.branch.sdk.UriScheme">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="myapp" />
 </intent-filter>
 <intent-filter android:autoVerify="true" android:name="io.branch.sdk.AppLink">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:host="myapp.app.link" android:scheme="https" />
</intent-filter>

What other intent actions or categories do I need there?

Shape answered 17/4, 2018 at 18:17 Comment(0)
S
2

What actually definitively resolved this was going into the AndroidManifest.xml and setting android:launchMode="singleTask" on my main activity.

I know that in the android docs it says singleTask is not recommended. I believe that's because it prevents you from going back but we take over the functionality of the hardware back button so that's not relevant. Also according to this SO answer, it seems like the right thing to do in our context.

Shape answered 30/8, 2018 at 21:15 Comment(0)
C
1

You should only need the intent filters listed here:

If it is opening your app within the Salesforce browser, then it may be that Salesforce is preventing users from deep linking out of it.

Crooks answered 17/4, 2018 at 22:32 Comment(1)
Ok, I checked the Salesforce app in the Settings app and found there was a setting to open linked within the salesforce app of in the other app.Shape

© 2022 - 2024 — McMap. All rights reserved.