I’m looking for a way to get a background location update every n minutes in my iOS application.. now i am getting update in every second.. can i change one second to three or four second or every minute…
Here is my code:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
if([self.delegate conformsToProtocol:@protocol(GPSLocationDelegate)]) {
// Check if the class assigning itself as the delegate conforms to our protocol. If not, the message will go nowhere. Not good.
[self.delegate locationUpdate:newLocation];
NSLog(@"location manager");
/// alert for check msg ////
////////////////////////////
}
}
You can not do it.
Alternatively you can achieve it by below way. When you get location updates, it will have the timestamp associated with it.
Cache the time stamp on first location update. When you receive the second location update, compare the difference and check. If it is greater than your threshold limit, call your delegate and update the cached time stamp with updated location’s time stamp.