Open alpennec opened 7 years ago
Hi! If you set acceptableLocationAccuracy
high and the location manager is not able to retrieve the location with the desired accuracy it will keep on trying. That is the only reason I can find why you keep getting inconsistent intervals.
Hi,
Thanks for your answer. I tried to set an acceptableLocationAccuracy
very high (1000m) to see if this was working as expected.
Have you tested it on your side, on a real device?
Thanks Axel
Yes I have. I just tested on iPhone running iOS 10.3.1. Not sure what to recommend
And it is working correctly on your side? Just with the example you provided in you repo?
On 26 June 2017 at 13:33, Aleksandrs Proskurins notifications@github.com wrote:
Yes I have. I just tested on iPhone running iOS 10.3.1. Not sure what to recommend
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paleksandrs/APScheduledLocationManager/issues/14#issuecomment-311034081, or mute the thread https://github.com/notifications/unsubscribe-auth/AB_HZvcMZLKmhb3PWZZbUcIxdPM1p1viks5sH5bugaJpZM4OErwi .
Yes it does. Try to debug it. See if waitTimerEvent
function is triggered, check if acceptableLocationAccuracyRetrieved
returns true
I just tried again with your project (I have customised it a bit for my use). I think the reason why I get inconsistent timers is because my device is in Low Power Mode. Can you try on your side? I also use Silent Push to wake up my app, same conclusion: if my device is in Low Power Mode, silent push are not received by the device.
it happens to me. I have come for seeking solution. i set the acceptableLocationAccuracy with in 1000m as well. when the phone is on(unlocked), the location updates regularly. when the phone is locked(screen is off), the location updates like 5-10 mins each time. and I haven't set to low power mode.
Have you tried with Low Power Mode disabled?
Axel Le Pennec
On 10 Jul 2017, at 20:19, carlhung notifications@github.com wrote:
it happens to me. I have come for seeking solution. i set the acceptableLocationAccuracy with in 1000m as well. when the phone is on(unlocked), the location updates regularly. when the phone is locked(screen is off), the location updates like 5-10 mins each time.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I mean I haven't turned on low power mode, never. but it still happens to me.
when you test the device, you should unplug it and lock your device. you will see. if i plug the cable in. the method will work regularly even you have turned off the screen.
@alpennec @carlhung @paleksandrs were you guys able to find any solution for this?
@raviAggarwal61 still, no.
@raviAggarwal61 solution for what exactly? For Low Power Mode?
@paleksandrs this problem occurs without low power mode too, in the locked state. This works fine when the device is connected to XCode and logs are printed but as soon as you unplug the device and repeat the locked state testing, updates stop completely, no matter what accuracy or distance filter.
Also, can you please explain this line perform(#selector(stopAndResetBgTaskIfNeeded), with: nil, afterDelay: 1)
, why we need to do this? As I was experimenting to understand, I changed the delay to 0.5 and 2 seconds, in both cases it stopped working. Struggling to understand, why is this working (only in background unlocked state) only for the 1-second delay.
@raviAggarwal61 can you reproduce this issue on the sample app that is provided without any modifications? If yes, what iOS version, device are you using, please provide detailed step by step guide. Also, have you configure your Xcode project by enabling Background Modes (Location updates)?
@paleksandrs yeah, this issue comes in sample app too, let me give you the steps.
PS: Although if you do not lock the phone and simply put the app in the background, everything works fine.
I am using iPhone 6 iOS 10.3.3 and background modes are configured for location updates. Attaching screenshot for reference.
Update: I checked it on some iOS versions and it seems to be working on iOS 9.3 but isn't working on 10.3.2, 10.3.3 and 11 beta. So probably something changed after iOS 10?
@raviAggarwal61 you said: this problem occurs without low power mode too, in the locked state. This works fine when the device is connected to XCode and logs are printed but as soon as you unplug the device and repeat the locked state testing, updates stop completely, no matter what accuracy or distance filter.
this is exactly happening on me.
@raviAggarwal61 i also tried slient notifications to kick my app to update. about first 1x slient notifications the device will get, afterward, you can't get any slient notifications for about 20 mins. then you will get again. I think the APN server can't accept too many notifications which will be thought as spam messages.
@raviAggarwal61 you are right. I retested and it seems that something has changed starting from iOS 10.3. I tested it on iOS 10.2 as well and everything worked. So I believe something has changed since 10.3 release. Not sure what solution could be at this moment.
I tested on iOS 11. I think it works again.
I have tested on ios 11. Also not working when device get locked. In unlock state and background seems to work fine. But n the moment the device locks it will not work anymore. Any suggestions? Improvements of the code?
ios 11.1 works as expected while locked and not in debug mode and not connected with cable
In my case location update stops when screen lock. so whats the solution for this? I want location every 30 seconds.
AlexGee17 fix works for me on iOS 11.4, location updated even when screen locked. parameter set as every 60 seconds and accuracy 10000.
Hello,
I tried to use this solution in a demo application. It works fine when I put the app in background, but as soon as I lock the device, I notice that the timers are not fired anymore at regular and defined interval. If I specify a time of 60 seconds, and I lock the device, the app is checking for a new location with a random duration between 5 and 15 minutes.
If I play a fake sound in background, the app behaves as expected and the timers correctly fire and restart the location manager. But I don't want to use this hacky solution...
Any idea why the timer is not running when device is locked?
Thanks, Axel