防止在原始应用的浏览器中打开 Deeplink

Roz*_*nyi 5 android deep-linking android-intent branch.io

我正在使用Branch.io从 Salesforce 应用程序到我的 Cordova 应用程序的 Deeplink。但是,当我单击 Salesforce 应用程序中的深层链接时,它只是在 Salesforce 应用程序内的浏览器中打开我的应用程序,而不是实际将我带到我的应用程序。似乎我应该使用 a<intent-filter/>来实现这一点,但它似乎无法将我带出原始 Salesforce 应用程序。这是我<intent-filter/>目前的情况:

 <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>
Run Code Online (Sandbox Code Playgroud)

我还需要哪些其他意图操作或类别?

Roz*_*nyi 2

实际上最终解决这个问题的是我的主要活动的开始AndroidManifest.xml和设置android:launchMode="singleTask"

我知道 在 android 文档中它说不推荐使用 singleTask 。我相信这是因为它阻止您返回,但我们接管了硬件后退按钮的功能,因此这是不相关的。另外,根据这个 SO 答案,在我们的背景下这似乎是正确的做法。