深层链接在三星本机应用程序中不起作用

igo*_*lov 5 android deep-linking android-intent galaxy

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

三星的应用

深层链接https://开头做的不是工作,而是意图:// 工作:

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

谷歌的应用

无论https://开头意图:// 工作:

  • 谷歌浏览器应用
  • Gmail 应用

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

代码

资产链接.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..."]
  }
}]
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

PS我用谷歌搜索并找到了很多SO帖子,但我发现没有一个真正有用。

小智 6

您所指的“https://”深层链接使用 Android 的应用链接机制来打开应用程序(查看此链接以获得一个很好的概述: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/)。

您提到的三星应用程序根本不支持应用程序链接 - 通常对应用程序链接的支持参差不齐。最安全的方法是同时支持 URI 方案链接/Chrome 意图和应用程序链接,因为您会发现不同的应用程序支持一种而不是另一种,反之亦然。