【问题标题】:How to directly land to the app without asking user choice in android deep link如何在不询问用户选择的情况下直接登陆应用程序 android 深层链接
【发布时间】:2019-09-12 10:05:18
【问题描述】:

我创建了一个深层链接,但问题是它以“打开或使用其他应用程序”的形式打开一个对话框

我不想让用户决定选择对话框。我想直接打开我的应用程序。这是代码。

<activity android:name=".DeepLinkingActivity">
    <intent-filter
        android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />

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

        <data
            android:host="www.google.com"
            android:pathPrefix="/help"
            android:scheme="https" />
    </intent-filter>
</activity>

class DeepLinkingActivity : AppCompatActivity() {
    var datas: Uri? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_deep_link)
    }

    override fun onResume() {
        super.onResume()
        var intent = intent
        datas = intent.data
        Log.v("TestingsDatas", "" + datas)

    }
}

【问题讨论】:

  • 那么你需要有自定义的 URI 方案/URL,而不是没有 HTTP 或 Https 的开头

标签: android kotlin applinks android-deep-link


【解决方案1】:

如果您不想看到该对话框。您必须验证您尝试导航的主机是否与您的应用程序相关。在此示例中,主机是“www.google.com”。 起初,这个 url 必须属于你。假设您拥有“www.example.com” 您将把 Digital Asset Links JSON 文件放到以下路径:

https://www.example.com/.well-known/assetlinks.json

其内容应如下所示,包括您的软件包名称和您的密钥库(用于 Google Play)sha256 指纹:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example",
    "sha256_cert_fingerprints":
    ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
  }
}]

你不会看到那个对话框。更多详情:https://developer.android.com/training/app-links/verify-site-associations.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    • 2018-02-10
    • 1970-01-01
    • 2014-11-01
    • 2014-09-18
    • 1970-01-01
    相关资源
    最近更新 更多