我知道有几个关于此的问题,但没有一个可以帮助解决我的问题。
我希望能够单击来自电子邮件/文本/浏览器并打开我的应用程序。
我有AndroidManifest.xml code:
<!-- Splash Activity -->
<activity
android:name=".ui.SplashActivity"
android:label="@string/app_name"
android:theme="@style/SplashTheme"
android:launchMode="singleTask">
<!-- Launcher intent filter -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Branch URI scheme -->
<intent-filter>
<data android:scheme="myscheme" android:host="open" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
这似乎遵循文档here https://developer.android.com/training/app-indexing/deep-linking.html然而,确切地说,当我使用 Chrome(或 Android 浏览器)浏览时myscheme://open
,我的应用程序无法打开,而是获得了 Google 搜索结果我的方案://打开.
谁能看出我在这里缺少哪一块拼图吗?如何通过 URI 打开我的应用程序?
小更新:
看完之后this https://stackoverflow.com/questions/11753000/how-to-open-the-google-play-store-directly-from-my-android-application,我发现将 Chrome 导航到market://details?id=com.myapp
does not打开游戏商店。相反,它返回 Google 搜索结果 - 与尝试直接启动我的应用程序时相同。这令人困惑。我是否缺少允许深度链接的全局操作系统设置?
Chrome 不会从手动输入的 URI 方案打开应用程序。事实上,手动输入的链接将never在 Chrome 中启动外部应用程序。这是设计使然——无论出于何种原因,Chrome 团队认为用户在输入地址后应始终保持在浏览器内。
您可以通过将深层链接置于用户驱动操作(标准<a>
标记,例如),但 Chrome 有自己的标准,称为 Chrome Intents,您应该使用它。根据您使用的设备,标准浏览器也可能出现这种情况。
在其他应用程序中,自定义 URI 方案是否被识别为“可点击链接”取决于相关应用程序。为了获得最佳兼容性,您需要将其包装在常规中http://
带有重定向的链接。
如果您有兴趣深入了解深层链接的复杂性,这个帖子 https://hackernoon.com/the-death-of-deep-linking-6cc65eb33e28是一个很好的起点。如果你只是想让它工作而不需要太多额外的努力,Branch.io https://branch.io(全面披露:我是 Branch 团队的成员)作为免费服务解决了这个问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)