Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Location Updates gets stopped after 17 - 18 minutes while running in background

didUpdateLocations is not being called after 17 - 18 minutes of running app perfectly in background. I've checked Location Updates option to make app run in background. App runs for 15 - 20 minutes then didUpdateLocation stops being called in background.

Please help

like image 985
Peter H Avatar asked Nov 28 '25 14:11

Peter H


1 Answers

Thanks for posting the solution. In Swift 3, I set pausesLocationUpdatesAutomatically = false and it seems to be working very well.

    let manager = CLLocationManager()
    manager.desiredAccuracy = kCLLocationAccuracyBest
    manager.delegate = self
    manager.requestWhenInUseAuthorization()
    manager.allowsBackgroundLocationUpdates = true
    manager.pausesLocationUpdatesAutomatically = false
like image 113
Nicholas K Avatar answered Dec 01 '25 02:12

Nicholas K



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!