Chrome 和 Samsung Internet 的 TWA 全屏 PWA
TWA Fullscreen PWA for Chrome and Samsung Internet
我正在尝试将我的 PWA(渐进式网络应用程序)转变为 Android 的 TWA(可信网络活动)应用程序。一开始一切正常,直到用户向我报告问题。
他根本无法打开应用程序,因此我们检查了可能是什么原因。原来他没有安装 Google Chrome 而是使用 Samsung Internet。
到目前为止,我确实设法让该应用程序与 Samsung Internet 配合使用,但是对于 Samsung Internet,地址栏仍然出现。
有一些教程可以为 Chrome 或 Samsung Internet 设置 TWA,但我如何将这两者结合起来?我想我们不应该强制用户先下载 Chrome。我还没有找到任何关于这个问题的文章,所以如果有人可以 link 我将不胜感激。
在浪费了大量时间试图自己解决这个问题并进行了大量研究之后,我发现了这篇文章:
https://medium.com/@firt/google-play-store-now-open-for-progressive-web-apps-ec6f3c6ff3cc
在哪里可以找到此信息:
TWAs work only with Chrome today, but the API might be also cloned by other browsers, such as Samsung Internet, Edge or Firefox in the future.
*UPDATE 2/4: The TWA works over the Android Custom Tab protocol that other browsers are currently implementing, so if the user doesn’t have Chrome or has changed the default browser, another browser might take precedence and open the TWA with the PWA content. More testing is needed to understand how it works.
What happens if the user has an older version of Chrome and installs the app from the Play Store? In this case, your PWA will appear as a Chrome Custom Tab, not in a completely standalone mode.
简而言之,这意味着什么:TWA 实际上是无用的,只要您需要您的应用程序与许多不同的设备兼容(就像大多数设备一样)。我还注意到,如果您在您的设备上禁用 Chrome,许多应用程序将无法运行,为什么我猜这些应用程序也在使用 TWA(而在 PlayStore 上却收到差评)。
所以我所做的就是放弃我用 TWA 所做的一切,而只是开始使用 Cordova。如果能像 TWA 这样简单地工作就好了,但只要它在没有安装 Chrome 的情况下就不能工作,就根本没有必要使用它。
并且没有直接在 https://developers.google.com 上说明这一点,但模糊不清,可能导致许多开发人员的时间浪费 and/or 大量用户无法使用某些应用程序。
我刚刚检查了我的 TWA,它适用于特定的浏览器,如下所示:
- Chrome没问题
- Edge 首次启动时会在 edge 中显示消息 运行,稍后会按预期运行
- Opera 按预期工作
- 三星浏览器 - 要求在浏览器中打开,但在浏览器中运行正常。如果在浏览器中打开则隐藏地址栏
- Firefox(曾经是最好的浏览器...)要求在浏览器中打开,如果打开它仍然显示地址栏
当使用受信任的 Web Activity 和推荐的 android-browser-helper library 时,应用程序将检查是否安装了支持受信任的 Web Activity 的浏览器,优先考虑用户的首选浏览器。
如果没有支持可用协议的浏览器,它将回退到使用 Custom Tab,如果自定义选项卡不可用,则打开浏览器。
该库还包含 WebView fallback for developers who prefer that to the Custom Tab / browser. A demo on how to use the WebView fallback is available here。
关于 Samsung Internet 浏览器,它在 2020 年 11 月(版本 13.0.2.9)添加了对 Trusted Web Activity 的支持。目前Chrome、Samsung Internet、Firefox、Edge等支持Trusted WebActivity,覆盖绝大多数用户。维护更新的浏览器支持列表 here。
我正在尝试将我的 PWA(渐进式网络应用程序)转变为 Android 的 TWA(可信网络活动)应用程序。一开始一切正常,直到用户向我报告问题。
他根本无法打开应用程序,因此我们检查了可能是什么原因。原来他没有安装 Google Chrome 而是使用 Samsung Internet。
到目前为止,我确实设法让该应用程序与 Samsung Internet 配合使用,但是对于 Samsung Internet,地址栏仍然出现。
有一些教程可以为 Chrome 或 Samsung Internet 设置 TWA,但我如何将这两者结合起来?我想我们不应该强制用户先下载 Chrome。我还没有找到任何关于这个问题的文章,所以如果有人可以 link 我将不胜感激。
在浪费了大量时间试图自己解决这个问题并进行了大量研究之后,我发现了这篇文章: https://medium.com/@firt/google-play-store-now-open-for-progressive-web-apps-ec6f3c6ff3cc
在哪里可以找到此信息:
TWAs work only with Chrome today, but the API might be also cloned by other browsers, such as Samsung Internet, Edge or Firefox in the future.
*UPDATE 2/4: The TWA works over the Android Custom Tab protocol that other browsers are currently implementing, so if the user doesn’t have Chrome or has changed the default browser, another browser might take precedence and open the TWA with the PWA content. More testing is needed to understand how it works. What happens if the user has an older version of Chrome and installs the app from the Play Store? In this case, your PWA will appear as a Chrome Custom Tab, not in a completely standalone mode.
简而言之,这意味着什么:TWA 实际上是无用的,只要您需要您的应用程序与许多不同的设备兼容(就像大多数设备一样)。我还注意到,如果您在您的设备上禁用 Chrome,许多应用程序将无法运行,为什么我猜这些应用程序也在使用 TWA(而在 PlayStore 上却收到差评)。
所以我所做的就是放弃我用 TWA 所做的一切,而只是开始使用 Cordova。如果能像 TWA 这样简单地工作就好了,但只要它在没有安装 Chrome 的情况下就不能工作,就根本没有必要使用它。
并且没有直接在 https://developers.google.com 上说明这一点,但模糊不清,可能导致许多开发人员的时间浪费 and/or 大量用户无法使用某些应用程序。
我刚刚检查了我的 TWA,它适用于特定的浏览器,如下所示:
- Chrome没问题
- Edge 首次启动时会在 edge 中显示消息 运行,稍后会按预期运行
- Opera 按预期工作
- 三星浏览器 - 要求在浏览器中打开,但在浏览器中运行正常。如果在浏览器中打开则隐藏地址栏
- Firefox(曾经是最好的浏览器...)要求在浏览器中打开,如果打开它仍然显示地址栏
当使用受信任的 Web Activity 和推荐的 android-browser-helper library 时,应用程序将检查是否安装了支持受信任的 Web Activity 的浏览器,优先考虑用户的首选浏览器。
如果没有支持可用协议的浏览器,它将回退到使用 Custom Tab,如果自定义选项卡不可用,则打开浏览器。
该库还包含 WebView fallback for developers who prefer that to the Custom Tab / browser. A demo on how to use the WebView fallback is available here。
关于 Samsung Internet 浏览器,它在 2020 年 11 月(版本 13.0.2.9)添加了对 Trusted Web Activity 的支持。目前Chrome、Samsung Internet、Firefox、Edge等支持Trusted WebActivity,覆盖绝大多数用户。维护更新的浏览器支持列表 here。