I want to achieve a functionality in which I use the GPS for the loaction updates and when the user is not moving, I want the GPS updates to be paused. AS per the "Staying on track with Location services " video, I did this:
//Configure Location Manager
self.theLocationManager = [[CLLocationManager alloc]init];
[self.theLocationManager setDelegate:self];
[self.theLocationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[self.theLocationManager setActivityType:CLActivityTypeFitness];
NSLog(@"Activity Type Set: CLActivityTypeFitness");
[self.theLocationManager setPausesLocationUpdatesAutomatically:YES];
[self.theLocationManager startUpdatingLocation];
Delegates:
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations
{
NSLog(@"Started location Updates");
}
- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
{
NSLog(@"Pausing location Updates");
}
- (void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager
{
NSLog(@"Resuming location Updates");
UIAlertView *pop = [[UIAlertView alloc]initWithTitle:@"Info" message:@"Location Updates resumed" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[pop show];
[pop release];
}
I did not get the desired behavior and the delegates "didPause.." and "didResume..." were not even called when the device was Idle.
Ideally GPS updates must stop and resume depending on the state of the device and CLActivityType but its not the case here.
Can anyone help me, what am I doing wrong?
Thanks in advance.
The pause should occur if you let the device at a same location for about 15 minutes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With