且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从渐进式 Web 应用程序中获取设备信息

更新时间:2022-12-21 20:52:36

Google 广告 ID 无法访问浏览器中运行的渐进式网络应用程序,因此安装的 PWA.

Google Advertising ID is not accessible to progressive web app running in browser and so the installed PWA.

也就是说,您可以使用 Android 服务(这是获取 Google 广告 ID 的本机代码)将其提供给已安装的 PWA 并将其传递给您的 PWA 使用深层链接s,通过使用 URL 和 PWA 设置缩进过滤器将在您的本机代码中检索到的 ID 传递给查询段 (URL) 中的网络应用.

Said that, you can make it available to your installed PWA using an Android service(which is a native code getting the Google Advertising ID) and passing it to your PWA using Deep links, by setting a Indent filter to your PWA with a URL and have the ID retrieved in your native code passed to web app in the query para (URL).

你可以参考这个java 代码 来检索设备标识符并将其包装为 Android 服务,该服务使用深层链接调用您的 PWA.

You can refer to this java code to retrieve device identifiers and wrap it as a Android service, which calls your PWA using deep links.