我如何深层链接到我的 Android 应用程序上的特定页面
How do i deeplink to a specific page on my Android App
我正在尝试深层链接到我的 Android 应用中的特定页面。
这是我试过的:
DeepLinkingTest://?screen=ResetResponse
但它只是打开应用程序主页
更新:
我刚试过:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="deeplinkingtest"
android:host="resetresponse"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
但仍在主页上打开
将要通过深度 link 打开的 activity 的意图过滤器添加到其在 AndroidManifest.xml
中的定义中。这是一个例子:
<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_title_viewgizmos">
<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 "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-->
<!-- Accepts URIs that begin with "example://gizmos” -->
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>
</activity>
在此示例中,GizmosActivity
是您要通过深度 link 开始的 activity。
我正在尝试深层链接到我的 Android 应用中的特定页面。
这是我试过的:
DeepLinkingTest://?screen=ResetResponse
但它只是打开应用程序主页
更新:
我刚试过:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="deeplinkingtest"
android:host="resetresponse"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
但仍在主页上打开
将要通过深度 link 打开的 activity 的意图过滤器添加到其在 AndroidManifest.xml
中的定义中。这是一个例子:
<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_title_viewgizmos">
<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 "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-->
<!-- Accepts URIs that begin with "example://gizmos” -->
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>
</activity>
在此示例中,GizmosActivity
是您要通过深度 link 开始的 activity。