navigator.geolocation.getCurrentPosition() when screen is locked

后端 未结 2 1333
离开以前
离开以前 2021-01-22 21:18

I have an App which constantly polls for location when its in travelling mode. My issue is that once the screen is locked, the App can no longer access the geolocation from the

2条回答
  •  无人及你
    2021-01-22 22:13

    Another option is to use a partial wakelock on Android to keep your app alive while in the background (screen off or switched out of foreground). You'd need to do this via a plugin, but it would have the same effect as a background service, keeping you app alive to receive location updates while in the background.

    See my old answer here for the source code for a Cordova 2.0 plugin (it will need updating for Cordova 3+).

提交回复
热议问题