Worklight - Geo location not working in background in iOS - ios

I have implemented the Location services in android and it can continually get the device's position even when the application is in the background. However, when I tried it running in an iOS Simulator and iOS device, the device stops retrieving its location when I place the application in the background. I don't think this should be the behavior. Is there other settings needed to be configured for iOS? thank you very much in advance.

Per the discussion in the comments:
Make sure to also set the Geolocation permissions in the *-info.plist file in Xcode per the instructions in the training module (slides 21-22) and/or the user documentation.

Related

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?
#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 Issuehttp://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

"AirLocate" sample code calibrate's option does not work

I'm an iBeacon feature newbie and I'm running the AirLocate sample code here to configure an iOS device as an iBeacon device for learning and testing. As the "readme" file in the project says, I've launched the app on an iPhone 5 and an iPad 4, both running iOS 8. I've set one of them as target device by switching on the "Enable" switch in the "Configuration" option of the app, and I've chosen the "Calibration" option in the app in the other device. The target device is supposed to be displayed in the table of the calibration device, but I'm isplayed nothing.
I've swept the roles of both devices (target-calibration), but none of them seems to detect the other one.
What could I be missing?
Thanks
Here is a possible answer. I had developed my own app to configure iBeacons, but when I updated to iOS 8 I had to add this line of code to get it working
[self.locationManager requestWhenInUseAuthorization];
Now you can try add this line to AirLocate (if it does not have) and answer yes when asking to access your resources. Place this in a ViewController you access, otherwise won't get fired.
Another way could be to build your own app to handle iBeacons following tutorials or Apple's Doc, actually it's not such an effort.
There are for sure anyway other free apps, but I don't know, try to google.
Now it is working for iOS 8 after applying the changes described in this post

Create Geolocation plugin for phonegap iOS to run in background

since watchposition doesn't run for more than 30 min in background, i have to create a geolocation plugin in order to register position every 5 minute on my webserver.
Ther problem is that i don't know quite nothing about objective-c. So anyone can help me or give me some parts of code with i can do something? thanks in advance
You don’t need to create a plugin for your phonegap app to receive location updates in the background. I’ve produced an iOS version of my phonegap-based navigator app and successfully got it receiving position updates while running in the background. I’ve tested it extensively in the “real-world” and it works reliably without any limit on the duration for receiving location updates.
Firstly, you need to be using XCode to develop your phonegap app - I’m not sure you can set the correct properties in your iOS app if you’re using Phonegap Build. You can set the “UIBackgroundModes” key with a value of “location”, which will cause iOS to trigger the JS callback function you have registered with 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”.
Hope this helps!

PhoneGap iOS getCurrentPosition while app is in background

I'm developing an app which tracks the geoLocation of a user using PhoneGap/Cordova. Knowing the users location even while the app is in background is crucial. I find a lot of conflicting information on google groups and forums. Some claimed it can work and others claim it doesn't work at all because Apple denies JavaScript to be executed in the background. Lot's of information is already dated and the hacks and workarounds I tried failed.
I added the "Required background modes" / "App registers for location updates" property to my projectname.info.plist.
My simple question is; is collecting geo information with a PhoneGap iOS app running is the background even possible?
Regards!
The answer is no. Apple does not allow Javascript to be executed when the app is in the background. A possible solution is to create a phonegap plugin which does this without using Javascript.

Removed Core Location from application but still being asked for users location

I removed the Core Location framework from an existing iOS application. I removed all relevant code which requires Core Location.
Even after deleting the build from the device and deploying a new build, I am still receiving a prompt asking for my location.
I had a similar problem before and had to format the device. Problem is, this is version 2 of an application which is already released. I do not want users prompted for Core Location if I am not going to use it. Any thoughts?
Have you checked your Info.plist file? You might have "App registers for location updates" in your "Required background modes" section.
Did your app startMonitoringSignificantLocationChanges or did you use startMonitoringForRegion:desiredAccuracy:? If you did, the os might still have your app registered for these. Then you would just have to stop these and it should work.

Resources