Trusted Web Activity 在本地保存数据
Trusted Web Activity save data locally
我有一个 PWA,我将用户设置保存在本地存储上,我想通过 TWA 将这个 PWA 部署到 Play 商店。问题如下:
The host app doesn't have direct access to web content in a Trusted Web
activity or any other kind of web state, like cookies and localStorage.
Nevertheless, you can coordinate with the web content by passing data to and
from the page in URLs (e.g. through query parameters, custom HTTP headers, and
intent URIs.)
根据 google 所说,我不明白如何在 PWA 上使用 TWA 保存客户端的用户设置。
如果你能给我一个例子,我将不胜感激。
使用 TWA 的应用程序由本机代码(例如:Java 或 Kotlin)和 Web 代码(HTML、CSS 和 JavaScript)组成。
文中描述的"host app"是对app原生部分的引用,用于"launch"web部分,即TWA。该应用程序的本机部分将无法访问 localStorage。
应用程序的 Web 部分 (PWA) 将可以正常访问 localStorage、cookie 等。
换句话说,使用 localStorage 和 Trusted Web Activities 的 PWA 应该按预期运行。
此存储也与 Chrome 共享。
我有一个 PWA,我将用户设置保存在本地存储上,我想通过 TWA 将这个 PWA 部署到 Play 商店。问题如下:
The host app doesn't have direct access to web content in a Trusted Web
activity or any other kind of web state, like cookies and localStorage.
Nevertheless, you can coordinate with the web content by passing data to and
from the page in URLs (e.g. through query parameters, custom HTTP headers, and
intent URIs.)
根据 google 所说,我不明白如何在 PWA 上使用 TWA 保存客户端的用户设置。 如果你能给我一个例子,我将不胜感激。
使用 TWA 的应用程序由本机代码(例如:Java 或 Kotlin)和 Web 代码(HTML、CSS 和 JavaScript)组成。
文中描述的"host app"是对app原生部分的引用,用于"launch"web部分,即TWA。该应用程序的本机部分将无法访问 localStorage。
应用程序的 Web 部分 (PWA) 将可以正常访问 localStorage、cookie 等。
换句话说,使用 localStorage 和 Trusted Web Activities 的 PWA 应该按预期运行。
此存储也与 Chrome 共享。