PWA 可以访问联系人、gps 或使用 phone 相机吗?

Can PWA access contacts, gps or use the phone camera?

PWA 可以访问联系人、gps 或使用 phone 相机吗?

这在任何系统中都可能吗 (ios, android)?

是否有任何开发计划来实现这些功能?

这取决于 PWA 运行 所在的设备。

相机和音频似乎得到普遍支持。另一方面,无论平台如何,联系人似乎都无法访问。

GPS 和地理定位等其他功能可能因设备而异。

了解您的浏览器功能(以及您的 PWA - 它在网络浏览器中运行)的一个好方法是使用您想要支持的浏览器转到 https://whatwebcando.today。尝试使用 iPhone、Android 或其他设备访问它以获取已启用功能的列表。

此列表会随着浏览器和 OS 开发人员增加对本机功能的访问而变化,因此有一个很好的变化,即使现在不可用,将来也会有。但是,请务必注意,出于安全原因,某些功能(例如访问更广泛的文件系统和硬件配置)可能会保留在沙盒中。

PWA 无法克服一些限制:

- 您无法 访问 phone 上的联系人列表。
- 另一方面,您可以拍照并使用 GPS 定位。

whatwebcando.today 网站上,您可以通过浏览器获得 API 与本机应用程序相比可用的列表。如果单击一项功能,您可以看到一个示例片段,其中显示了如何实现它以及有关浏览器支持的详细信息。


更新 2019 年 9 月 30 日

从 Chrome v77 开始,有一个新的实验性 API 可用:Contact Picker

The Contact Picker API is an on-demand API that allows users to select entries from their contact list and share limited details of the selected entries with a website. It allows users to share only what they want, when they want.

For example, a web-based email client could use the Contact Picker API to select the recipient(s) of an email. A voice-over-IP app could look up which phone number to call.

因此,剩余的 PWA 限制可能会在不久的将来得到解决。