深层链接在三星原生应用程序中不起作用

时间:2017-01-30 00:33:09

标签: android android-intent deep-linking galaxy

三星Galaxy S6,Android Marshmallow 6.0。用Unity开发。

三星的应用

深层链接 https:// 执行,但 intent:// 执行的工作方式为:

  • 互联网应用
  • 备忘录应用

Google的应用

https:// intent:// 执行工作于:

  • Google Chrome应用
  • Gmail应用

有关于三星自定义应用的信息吗?

代码

assetlinks.json

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.xxx.app",
    "sha256_cert_fingerprints":
    ["4E:CC:14:62:B3:1D:13..."]
  }
}]

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- REPLACE  com.companyname.projectname to your app bundle ID-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xxx.app" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
  <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="23"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="1" />
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false">
    <activity android:name="causallink.assets.DeepLinkBridge" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
      <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:scheme="https" android:host="v.xxx.com" />
      </intent-filter>
    </activity>
  </application>
</manifest>

P.S.我用Google搜索并发现了很多的SO帖子,但我发现其中没有一个真的有用。

2 个答案:

答案 0 :(得分:4)

您引用的“https://”深层链接正在使用Android的App Links机制打开应用(请查看此链接以获得良好的概述:https://blog.branch.io/technical-guide-to-deep-linking-android-app-links/)。

“intent://”深层链接正在使用Chrome Intents(请检查:https://blog.branch.io/technical-guide-to-deep-linking-on-android-chrome-intents/)。

您提到的三星应用程序根本不支持App Links - 一般来说,对App Link的支持是不稳定的。最安全的方法是支持URI Scheme链接/ Chrome意图和App链接,因为你会发现不同的应用程序支持一个而不支持另一个 - 反之亦然。

答案 1 :(得分:0)

你可以尝试这个多配置..希望它的工作

<intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data
                android:host="v.xxx.com"
                android:pathPrefix="/yourpath"
                android:scheme="http" />
            <data
                android:host="www.v.xxx.com"
                android:pathPrefix="/yourpath"
                android:scheme="https" />
            <data
                android:host="*.v.xxx.com"
                android:scheme=""
                android:path="/yourpath/" />
            <data
                android:path=""
                android:pathPrefix="/*"
                android:pathPattern="\?"
                android:pathPattern="put your regex" />

</intent-filter>