【问题标题】:AppLinks for Android适用于 Android 的 AppLinks
【发布时间】:2017-06-02 05:16:07
【问题描述】:

当我点击应用链接时,我需要选择 chrome 或我的应用

我查看我的网站Google Statement List Generator and Tester 我在下面

Success! Host XXX grants app deep linking to XXX.

但是 adb shell dumpsys 包 domain-preferred-apps 显示

"Status: undefined"

有人知道怎么解决吗?

清单.xml `

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:scheme="https"
                android:host="XXXX.XX"
                android:path="/test" />
        </intent-filter>`

applinks 状态不是“总是”如何改正???

"Status: undefined"

【问题讨论】:

  • 您是否在我们的代码中使用了 ActivityChooser ?
  • 没有。当我单击我的 Android 应用启动的 html 链接时,我想这样做

标签: android android-studio applinks


【解决方案1】:

将此代码放在 TextView onClick Listener..

String urlString="http://www.google.com";
Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(urlString));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("com.android.chrome");
try {
context.startActivity(intent);
} catch (ActivityNotFoundException ex) {
// Chrome browser presumably not installed so allow user to choose instead
intent.setPackage(null);
context.startActivity(intent);

}

【讨论】:

  • 这是一个网页,不在我的应用中
  • 问题是如何设置我的安卓应用程序!!!网页是正确的。
【解决方案2】:

为避免看到选择器,您需要设置已验证的应用链接。有关说明,请参阅here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-13
    • 1970-01-01
    • 2012-01-27
    • 2022-01-13
    • 1970-01-01
    • 1970-01-01
    • 2013-01-19
    相关资源
    最近更新 更多