If user changes their Location settings

from ‘always’ to ‘when in use’ .

And doesn’t go back to the application. Sometimes I see the blue bar and sometime I don’t see it.

If blue bar doesn’t show then my app can get removed from memory.

The only thing I do in my didChangeAuthorization method is that if it’s not restricted, denied, .notDetermined then I call startUpdatingLocation().

I know I can't make the app startUpdatingLocation while it's in background.

But shouldn't I be able to continue that when I do it change from 'Always' to 'when in use'?! Is this a behavior I have no control over it ?

1

There are 1 best solutions below

0
On BEST ANSWER

After more rounds of testing. With great confidence I can say:

If you switch to Never then the OS will call stopUpdatingLocation in 10 seconds or less.

So if before you reach the 10 seconds you switch to 'when in use' then you'd see the blue bar and you're all good.

If you wait for 10-20 seconds then you would no longer see the blue bar because the stopUpdatingLocation is called. To start tracking again you must bring the app in foreground and then it would start updating your location again.

Switching between 'Always' and 'when in use' should not ever result in stopping your location tracking. Likely it happened because I went to Never and stayed for more than 10 seconds, then switched to Always and then 'when in use' and I did all that—without opening the app and thought it was because I changed from Always to 'when in use'. So this was somewhat a false alarm.