Question

Can anyone please let me know if it is possible to handle events like OrientationChanged, Shake, LocationChanged etc.. when my App running in background?

I have tried following code but it gets invoked only when my app running in foreground!

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
//if the time interval returned from core location is more than two minutes we ignore it because it might be from an old session
if ( abs([newLocation.timestamp timeIntervalSinceDate: [NSDate date]]) < 120) {     
    self.currentLocation = newLocation;
}
NSLog(@"lat: %f long:%f",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude);
}

Thanks.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top