I'm working on an application that uses location. The application can save a route on a map and if the user wants to record a route, the app have to work on background storing the user location to show it after that on the map.
To save the location on background I used the property NSLocationAlwaysUsageDescription defined on the plist of the application
My problem is that it's possible that user never wants to record any routes, but because of the way I'm defining that the app have to store location on background, my app seems to work always on background and it wastes so much battery even when could be not necessary to work on background.
I also start and stop the update of the location on my viewDidAppear and viewDidDisappear methods to avoid the update of the location when I'm not on the map screen:
- (void)viewDidAppear:(BOOL)animated
{
...
[[SBLocationManager sharedInstance] startUpdatingLocation];
...
}
- (void)viewDidDisappear:(BOOL)animated
{
[[SBLocationManager sharedInstance] stopUpdatingLocation];
[self.stationProvider stopProviding];
}
I've been looking about that but I don't find a way to set the background location on/off when I want. Do you know if there is a way to "enable/disable" the location on background while you're on the app to let the user configurate it?
Thanks so much for your help :) See you here!