[英]How to use PathPattern in order to create DeepLink Apps Android?
[英]How to use deepLink in Android
請幫助我
在我的應用程序中,我想使用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>
我如何修復它,當從移動設備點擊這個 Url 時,建議我的應用程序?
我試過在我的活動中使用你的鏈接並且工作正常。
我的活動清單:
<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)
將 pathPattern 添加到您的數據標簽中,如下所示:
<data
android:host="sosapp"
android:pathPattern="/*"
android:scheme="sosapp" />
嘗試添加標簽,對於更高版本的android,這是強制性的。 請參閱文檔中的示例。 他們總是包含一個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.