如何在我的Android应用程序上深层链接到特定页面 [英] How do i deeplink to a specific page on my Android App

查看:103
本文介绍了如何在我的Android应用程序上深层链接到特定页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试深链接到我的Android应用程序上的特定页面。

I'm trying to deeplink to a specific page on my Android app.

这是我尝试过的操作:

DeepLinkingTest://?screen=ResetResponse

但是它只是打开应用程序主页

but it just opens the app home page

更新:

I我刚刚尝试过:

<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>

但仍在主页上打开

推荐答案

为要通过 AndroidManifest.xml 中的定义打开的活动打开意图过滤器。这是一个示例:

Add intent filter for the activity that you want to open via deep link to its definition in the AndroidManifest.xml. Here is an example:

<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 是活动您想通过深层链接开始。

In this example, GizmosActivity is the activity you want to start via deep link.

这篇关于如何在我的Android应用程序上深层链接到特定页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆