ivan
ivan

Reputation: 299

Get gps location in Cordova while in background

Everything seems deprecated. I tried mauron85/cordova-plugin-background-geolocation but it's own dependencies are 404. cordova-plugin-geolocation doesn't work while in the background.

Does anyone have a configuration for getting the gps while the app is in the background? I need to use them within the javascript, not even send them directly to the backend.

EDIT: I ended up writing my own plugin. Also it did not work properly on android before I added a foreground service.

Upvotes: 1

Views: 79

Answers (1)

Eric
Eric

Reputation: 10658

You can't use JavaScript if the app is in the background, as it is halted, hence you need to send to a server, then pull from the server from your JavaScript when the app is resumed (via the foreground event). What are the dependencies that you report as 404, out of curiosity?

Upvotes: 1

Related Questions