从另一个Android应用程序调用渐进式Web应用程序

3
我有一个问题 我有一个 PWA,我想使用 URL(例如 mypwascheme:http://my.test.host/mypage)从另一个应用程序打开它。
但我不知道应该使用什么方案部分,即 mypwascheme。
我尝试了我的应用程序名称和 manifest.json 中的短名称,但都没有起作用。
有什么想法吗? 提前致谢
1个回答

1
你可以使用Android Intent Filters。所以基本上,你可以在你的应用程序中嵌入一个网页链接(一个普通的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>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接