katzer / cordova-plugin-background-mode

Keep app running in background
Apache License 2.0
1.38k stars 1.02k forks source link

iOS 8 geolocation warning shows even when no GPS watch active #41

Closed levic closed 9 years ago

levic commented 9 years ago

The new iOS 8 blue bar that says "SomeApp is Using Your Location" shows up even if location tracking is not running if it was running at some point in the background in the past.

Gist here: https://gist.github.com/levic/6a5d4b9c1b6ea1fcd147

Steps to replicate:

This occurs on iOS 8 if an app's location services setting is set to "While Using" (doesn't happen if is set to "Always").

Tested with

It seems possible that this could in fact be a bug with cordova geolocation itself assuming it won't ever run in the background, but there was nothing obvious in CDVLocation.m.

levic commented 9 years ago

Upon further investigation it has nothing to do with the geolocation module, but it simply the fact that the plugin uses a LocationManager as a way of keeping background mode running.

On iOS 8 then you should do:

window.plugin.backgroundMode.disable(); on device ready window.plugin.backgroundMode.enable(); before starting any geolocation watcher window.plugin.backgroundMode.disable(); after stopping any geolocation watcher

This should probably be mentioned in documentation.

katzer commented 9 years ago

the plug-in (master) does not use geolocation anymore