Reputation: 369
All, I'm working on an application that uses geolocation services provided by phonegap (using latest version 2.2.0. I'm testing this for now only on IOS (ultimately I wanted to work at least on Android as well). On IOS when application in foreground all works fine. When the application goes to background however the geocoding stops working and I don't get the change position event anymore. I do have the required "App registers for location updates" under Required background modes section of my app-info plist and I've done ISO coding using this flag and my application reports the location change even when app is in background so I was wondering why this is not working on phonegap.
I'm not doing any fancy work. My code is simply a copy of what cordova code is for watchPosition.
Any pointers or help would be appreciated.
Amir
Upvotes: 1
Views: 3251
Reputation: 3077
The problem is that JavaScript in PhoneGap does not run when the app is in the background. To provide background process capability you'll need to create a plugin to manage the background process.
http://docs.phonegap.com/en/2.2.0/guide_plugin-development_index.md.html
I know of an already existing plugin to do this for Android but not one for iOS.
https://github.com/phonegap/phonegap-plugins/tree/master/Android/BackgroundService
Upvotes: 1