0

i am working on one tracking application in that i use location manager service and

set desiredAccuracy = kCLLocationAccuracyNearestTenMeters

and distanceFilter = 60.0.

i want to give background support. for that i

set App registers for location updates,

App downloads content from the network

in my info.plist. and i put

[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum];

this code in didFinishLaunchingWithOptions method.

i also use this method for call startUpdatingLocation location manager method

- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

this all work in iOS 7 with iPhone4

but i have other two device in iPhone4S and iPhone5 in that device when device is ideal at that time application is in background so the navigation symbol get disappear and my location data not get updated on server.

when phone is ideal and when i start my application its not in background my application start from login screen.

so background location update not work for iPhone5 and iPhone4S having iOS7.

Please provide me solution for this.

my application is for tracking purpose if i am not get updated location so it is useless.

Rashad
  • 11,057
  • 4
  • 45
  • 73
Gaurav Thummar
  • 780
  • 1
  • 12
  • 22
  • At what interval you need to get your location update in background. – Utkarsh Goel Oct 08 '13 at 11:14
  • If you are trying to make it works on background for iOS 7, you may try this solution here: http://stackoverflow.com/questions/18946881/background-location-services-not-working-in-ios-7/21966662#21966662 If you have any question, you are welcomed to join us for a discussion here: http://mobileoop.com/background-location-update-programming-for-ios-7 – Ricky May 01 '14 at 15:25

2 Answers2

1

you can add this methods in your AppDelegate.m

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
        NSLog(@"ending background task");
        [[UIApplication sharedApplication] endBackgroundTask:bgTask];
        bgTask = UIBackgroundTaskInvalid;
    }];

    timer = [NSTimer scheduledTimerWithTimeInterval:5
      target:locationManager
      selector:@selector(startUpdatingLocation)
      userInfo:nil
      repeats:YES
    ];
}
Wilq
  • 2,245
  • 4
  • 33
  • 37
Piyushkumar
  • 418
  • 4
  • 10
0

you can take help with below link: Start Location Manager in iOS 7 from background task

to get your location update at interval of every 5 minutes.

Community
  • 1
  • 1
Utkarsh Goel
  • 245
  • 2
  • 5