请帮助面

在我的应用程序中,我想使用DeepLink,为此,我编写了以下代码。
但是,当运行应用程序时,不建议我的应用程序,而是在Chrome浏览器中显示!

我的网址:sosapp://sosapp/hashcode/ghfhgfhgf?

我的代码:

<activity
    android:name=".Activity.LandingActivity"
    android:screenOrientation="sensorPortrait" />
<activity
    android:name=".Activity.MainActivity"
    android:screenOrientation="sensorPortrait">

    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:scheme="sosapp" android:host="sosapp"/>
    </intent-filter>

</activity>


我该如何解决?当从移动设备上单击此网址时,建议使用我的应用程序?

最佳答案

我尝试在“活动”中使用您的链接,效果很好。

我的活动清单:

<activity android:name=".MyActivity">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="sosapp"
                android:scheme="sosapp" />
        </intent-filter>
    </activity>


我的意图是用来叫活动

val action = Intent()
action.data = Uri.parse("sosapp://sosapp/hashcode/ghfhgfhgf?")
startActivity(action)

09-10 06:54
查看更多