有没有办法为 PWA(渐进式 Web 应用程序)创建本机线程?我需要在浏览器关闭时访问地理定位

Is there a way to create a native thread for PWAs (Progressive Web Apps)? I need to access Geolocation when the browser has closed

我有一个需要不断更新用户位置的 Progressive Web App。

Service workers 不合适,因为他们无法访问 navigation.geolocation 对象,并且我当前使用 React 组件的解决方案在关闭浏览器时停止。

我已尝试使用 React Native Workers (https://github.com/devfd/react-native-workers),但无法使用 create-react-app 安装。

乐于接受想法。

不,如果您想要一个较长的后台进程,运行 您必须创建一个本机应用程序。