14

我已经集成了用于深度链接的branch.io SDK 。

我的深层链接流程是,当我单击 URL 时,如果它已安装在用户手机中,它将打开我的应用程序,否则它将重定向到用户可以安装应用程序的Play 商店

如果我使用 chrome 浏览器浏览链接,则此流程运行良好,但如果我使用任何其他浏览器应用程序进行浏览,例如UCOperaSamsung默认浏览器,则此流程不起作用,无论哪种方式,它都会重定向到 Play 商店。

任何人对此有解决方案,请告诉我!

谢谢你的帮助!

4

2 回答 2

1

关于older Android devices使用URI Schemes and App Links. 这些问题不仅限于分支链接。

于 2017-02-21T01:09:42.277 回答
-1

创建应用内容的深层链接:

<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" />
        <!-- 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>

从传入的意图中读取数据:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Intent intent = getIntent();
    String action = intent.getAction();
    Uri data = intent.getData();
}

测试您的深层链接:

使用 adb 测试意图过滤器 URI 的一般语法是:

$ adb shell am start
        -W -a android.intent.action.VIEW
        -d <URI> <PACKAGE>

例如,下面的命令尝试查看与指定 URI 关联的目标应用程序活动。

$ adb shell am start
        -W -a android.intent.action.VIEW
        -d "example://gizmos" com.example.android

阅读更多:

1) https://developer.android.com/training/app-links/verify-site-associations.html#the-difference
2) https://docs.branch.io/pages/links/integrate/

于 2018-01-13T14:52:04.040 回答