我有一個基本的 ReactJS 專案,我按照
uj5u.com熱心網友回復:
如果您使用的是 Capacitor,要向您的專案添加深層鏈接,請遵循本機程式。就像在android 檔案中解釋的那樣,你應該在你的清單檔案中有這個(位于 android/app/src/main/AndroidManifest.xml):
<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_view_http_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- **** -->
<!-- This is where you put your deeplinks with the 'data' tag: -->
<!-- **** -->
<!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
<!-- note that the leading "/" is required for pathPrefix-->
<!-- **** -->
<!-- **** -->
</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>
</activity>
要在打開應用程式后處理深度鏈接請求及其資料,請使用電容器檔案appUrlOpen中解釋的事件
更新
回答您的更新:
從 android 12 開始,除非您驗證 applink,否則 android 中的深層鏈接將直接打開瀏覽器。按照此說明驗證應用程式鏈接。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/532965.html
下一篇:離子電容器:閃屏顯示錯誤影像
