网页调用urlscheme无法唤起App问题解决

在做安卓AppLink的过程中,想要实现打开网页,自动跳转到App,如果App没有按转,则自动跳转到下载页面的效果。

在测试网页使用urlscheme打开App的过程中,始终无法成功。

之前网页的实现大致如下:

<!-- 方案一:链接跳转 -->

<a href="testscheme://">打开测试App</a>

<!-- 方案二:JS跳转 -->

<a href="javascript:location.href='testscheme://'">打开测试App</a>

App的manifest的配置如下:

<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="testscheme" android:host="download"/>

  </intent-filter>

配置完出包后无论如何触发方案一和方案二,都不会唤起App。

后面通过把manifest中的host删除,就可以成功通过方案一和方案二唤起App了。

最终的修改如下:

<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="testscheme" />

  </intent-filter>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容