ads

ads
[6] [top6news] [slider-top-big] [latest news]
You are here: Home / How to get Latitude and longitude when iOS app in background?

How to get Latitude and longitude when iOS app in background?

| No comment
SHARE


Sometime it is required to get current location's latitude and longitude when iOS app in background .

To do that you can use following way


  • First you should to change in info.plist file
           Required Background Modes (Array) 
           Add array element for App registers for location updates

  • Now Second Thing
          In Appdelegate.m

            (void)applicationDidEnterBackground:(UIApplication *)application{ 
                    [NSTimer scheduledTimerWithTimeInterval:1.0 
                                     target:self
                                   selector:@selector(callMethod) userInfo:nil repeats:YES];
           }
         }
       

 -(void)callMethod{
      NSLog(@"This Line prints after every 1 sec when app in background infinite times untill app will be in foreground"); 
}