[英]How to use deepLink in Android
PLEASE HELP MEEEE请帮助我
In my application i want use DeepLink and for this i write below code.在我的应用程序中,我想使用DeepLink ,为此我编写了下面的代码。
But when run application not suggest my application and just show in Chrome browser !但是当运行应用程序时不建议我的应用程序而只显示在 Chrome 浏览器中!
My Url : sosapp://sosapp/hashcode/ghfhgfhgf?
我的网址: sosapp://sosapp/hashcode/ghfhgfhgf?
My codes :我的代码:
<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>
How can i fix it and when click on this Url from mobile, suggest my app ?我如何修复它,当从移动设备点击这个 Url 时,建议我的应用程序?
I have tried use your link in my Activity and works fine.我试过在我的活动中使用你的链接并且工作正常。
my Activity Manifest:我的活动清单:
<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>
and my intent used to call the activity我的意图过去常常调用该活动
val action = Intent()
action.data = Uri.parse("sosapp://sosapp/hashcode/ghfhgfhgf?")
startActivity(action)
Add pathPattern to your data tag like below:将 pathPattern 添加到您的数据标签中,如下所示:
<data
android:host="sosapp"
android:pathPattern="/*"
android:scheme="sosapp" />
Try adding label, it's mandatory for higher versions of android.尝试添加标签,对于更高版本的android,这是强制性的。 See example from the docs.请参阅文档中的示例。 They always include a label for intent-filter
他们总是包含一个intent-filter
的标签
<intent-filter android:label="@string/filter_view_example_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmos” -->
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.