Search code examples
iosiphonegeolocationcllocationmanagerbackground-process

How to get location in background on iphone


i am developing app that get location in backGround even app is killed also.

My code is working fine in Simulator. but not Working in Any ios device. i have tested in iphone5s version(7.1) iphone4s(7.1) ipad 7.1 also.

Here is my code link: https://www.dropbox.com/sh/1x0uuhk0xb35bct/DUhQ20wC2j

Please Download and Suggest me. Thanks in advance.


Solution

  • In that case when your application is moved to background, you should register for significant location changes.

    - (void)applicationDidEnterBackground:(UIApplication *)application
    {
         [locationManager stopUpdatingLocation];
         [locationManager startMonitoringSignificantLocationChanges];
    }
    

    When application becomes active, you should do reverse to track the user aggressively.