Does anyone know how to turn off iPhone's GPS programmatically? Once I use the CLLocationManager to get three reads of my location I stop updating location as in the code below:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
if((newLocation.horizontalAccuracy > 0.0f) &&
(newLocation.horizontalAccuracy < 7000.0f) ){
if(self.locations.count > 3){
[self.locationManager stopUpdatingLocation];
}
[self.locations addObject:newLocation];
}
But this still seems to leave the GPS on while users are using my app and draining their battery. All I need to do is read the location three times so that I can get an accurate read, and then shut down the GPS. Does anybody know how to shut down the GPS with objective-C?