【问题标题】:Calling a Progressive Web App from another android application从另一个 android 应用程序调用 Progressive Web App
【发布时间】:2018-04-26 07:21:24
【问题描述】:
我有一个问题
我有一个 PWA,我想使用 mypwascheme:http://my.test.host/mypage
之类的 URL 从另一个应用程序打开它
但我不知道我应该在方案部分使用什么,即。 mypwascheme
我从 manifest.json 中尝试了我的应用名称和短名称,但都没有成功
有什么想法吗?
提前致谢
【问题讨论】:
标签:
android
google-chrome
progressive-web-apps
【解决方案1】:
您可以使用Android Intent Filters。所以基本上,您可以简单地将 Web 链接(一个普通的 URL,如 http://my.test.host/mypage )嵌入到您的应用程序中。当它尝试在浏览器中打开它时,PWA 应用会拦截请求(如果您在清单中定义了意图过滤器)并在那里打开它。
示例(使用您的示例 URL):
<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="my.test.host"
android:pathPrefix="/mypage/" />
</intent-filter>