Is it possible to take gps on when phonegap (iOS) app is in background?? In my app gps go off after some seconds. I use phonegap 3.1, backbonejs, requirejs, jquerymobile...
Some plugins???
thank's!
Is it possible to take gps on when phonegap (iOS) app is in background?? In my app gps go off after some seconds. I use phonegap 3.1, backbonejs, requirejs, jquerymobile...
Some plugins???
thank's!
To keep your app running in the background on iOS, you need to build it using Xcode in order to set a project property which will allow your app to receive location updates while in the background. As far as I know, Phonegap Build does not allow you to do this and does not do it for you.
You can either manually edit the project .plist and add the key “UIBackgroundModes” key with a value of “location” or, with your project open in XCode, add the "Required Background Modes" key with a value of "App registers for location updates". This will cause iOS to trigger the JS callback function you have registered with navigator.geolocation.watchPosition() each time a location update is received.
See this page for details about iOS project keys.
See this page for how to set the background modes key in XCode. The value you want to select is “App registers for location updates”.