android - 如何从 URL 打开应用程序?
问题描述
我的目标是在用户单击链接时打开我的 android 应用程序,例如我已经共享了特定的项目链接(http://example.com/api_shirts.php?utmsource=shirt98)然后如果用户已经安装了我的应用程序然后打开它在其他地方打开它在浏览器上。
我已经搜索了很多并得到了这个,但它对我不起作用
<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:scheme="http"
android:host="www.example.com" />
<data android:scheme="https"
android:host="www.example.com"/>
</intent-filter>
解决方案
我不确定您是否需要在这种情况下设置 pathPrefix。此外,操作系统可能会打开用户已设置为该架构的默认应用程序的其他首选应用程序。
如果我没记错的话,您必须将您的应用程序与您的网站相关联,以便操作系统可以绕过用户的选择直接打开应用程序:
https://developer.android.com/studio/write/app-link-indexing.html#associatesite
另外,请查看https://developer.android.com/training/app-links/verify-site-associations.html以了解“深层链接”与“应用程序链接”。您需要应用链接来完成您正在尝试做的事情。
推荐阅读
- c++ - 如何判断字体是否支持代理对 Unicode 字符?
- javascript - 如果两个 url 属于同一个服务器,CORS Isuue
- javascript - 如何创建动态s 基于范围滑块中选择的值具有多个输入?
- javascript - Javascript 中的递归在没有完成之前的 for 循环的情况下停止
- java - 如果我将他们的 ID 作为字符串,如何在 java 中使用不和谐机器人向用户添加角色?
- java - Camunda - 数据库快速增长问题
- laravel-5.7 - Laravel-api 表单插入数据库
- python - 为什么这个简单的程序会以超过 10 的值中断
- c# - 为什么用 .ToString("X4") 格式化的数字中有字符?
- python - TypeError:“问题”对象在测试用例断言中不可迭代