Kingalione
Kingalione

Reputation: 4275

cordova getting Location Updates for iOS 7 and 8 when the App is Killed/Terminated/Suspended

I'm working on a cordova application which needs to get location updates and send them to a server even if the device is in sleep mode. I can track the location of a device if the app is on foreground and also background with my version now. But after 10-15 minutes the app gets killed by OS and I no longer get any location updates until the user launches my app again.

Well in my search of finding a solution to this problem I found this article:

http://mobileoop.com/getting-location-updates-for-ios-7-and-8-when-the-app-is-killedterminatedsuspended

It shows how to get location updates even if the app gets killed. The main problem is that I'm not really sure that this could work with a non-jailbreaked iOS and I've never wrote a cordova plugin myself before.

So is it possible to track location and send those through socket.io or http to a specific server?

Or at least to write those geolocation updates in files which I would send when my app launched?

If the answer of my first question is yes: How should the plugin look like?

Upvotes: 0

Views: 232

Answers (1)

user3255670
user3255670

Reputation:

@Kingalione,
you can keep the App from being killed. There was a documentation error in Apple's documentation. Here is my blog post on this:

Slight Documentation Error causes Background Operations Issue
http://codesnippets.altervista.org/blog/2015/BLOG.2015-07-02.jssnippets.html

To apply this fix, you'll need to add to your .plist file. Unfortunately, I do not know how to do this for the Cordova CLI. Here is the section that you need for UIBackgroundModes

Upvotes: 1

Related Questions