Reputation: 814
I'm developing an IOS app in swift language with the Skobbler navigation SDK. I try to allow the user to use navigation while in background mode (IPhone locked).
I have question stated below :
1) Is it possible to do so without using the SDKTools and the SKTNavigationManager ? We only use SKMaps.frameworks functions.
With this configuration, I can't use the allowBackgroundNavigation property of SKTNavigationConfiguration like in the demo.
I set
SKPositionerService.sharedInstance().worksInBackground = true
and allowed the "location Update in BackgroundMode" to the info.plist. Unfortunately the updateCurrentLocation doesn't triggered in background and navigation doesn't works neither.
Thank you very much in advance :-) !!
P.S. : I succeeded to run a short code in background with the official library CCLocationManager. So my app seems correctly configured...
Upvotes: 1
Views: 164
Reputation: 1577
The hotfix for this issue can be downloaded from here:
ObjC: https://www.dropbox.com/s/ruk6at2fju0rdd7/SKMaps_2_5_1.zip?dl=0
Swift: https://www.dropbox.com/s/lgbdherhqzudy2a/SKMapsSwift_2_5_1.zip?dl=0
Upvotes: 1
Reputation: 2896
Sorry..this is not an answer, but a "Same Problem". updatedCurrentLocation
is not called when the app is in the background.
Thought I add some more code to give more info and perhaps find the cause:
My code:
SKPositionerService.sharedInstance().delegate = self
SKPositionerService.sharedInstance().worksInBackground = true
SKPositionerService.sharedInstance().automaticLocationUpdatePause = false
SKPositionerService.sharedInstance().startLocationUpdate()
Also tried putting SKPositionerService.sharedInstance().startLocationUpdate()
as first line. No luck.
When I run a CLLocationManager alongside the SKPositionerService like so:
locManager = CLLocationManager()
locManager.desiredAccuracy = 10000
locManager.distanceFilter = 10000
locManager.allowsBackgroundLocationUpdates = true
locManager.pausesLocationUpdatesAutomatically = false
locManager.startUpdatingLocation()
updatedCurrentLocation
IS being called while in background.
I used this when I was running 2.5.0 as that version was not yet iOS9 ready, but I thought that 2.5.1 would be. This of course is a horrible workaround as a 2nd locationmanager eats battery.
Could it be that, in the SKPositionerService implementation, you are not setting CLLocationManager().allowsBackgroundLocationUpdates
to true when SKPositionerService.sharedInstance().worksInBackground
is set to true?
btw I'm running the 2.5.1 hot fix posted here.
btw2: This can not be tested in the simulator. The simulator will call updatedCurrentLocation
even when the app is 'backgrounded'. I'm guessing because the simulator doesn't really have a 'background' mode.
btw3: I would be very surprised if background mode works for the SDKTools Navigation Manager... with this 2.5.1. hot fix)
Upvotes: 0