1

I have done an app using location update as background mode, and I am updating my location after each keepAlive interval using webservice. I am using the below mentioned code.

if ([application respondsToSelector:@selector(setKeepAliveTimeout:handler:)])
    {
        [application setKeepAliveTimeout:120 handler:^{

            DDLogVerbose(@"KeepAliveHandler");

            // Do other keep alive stuff here.
        }];
    }
    self.bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
        NSLog(@"ending background task");
        [[UIApplication sharedApplication] endBackgroundTask:self.bgTask];
        self.bgTask = UIBackgroundTaskInvalid;
    }];


    self.backgroundTimerForLocationUpdate = [NSTimer scheduledTimerWithTimeInterval:120
                                                                             target:self
                                                                           selector:@selector(changeAccuracy)
                                                                           userInfo:nil
                                                                            repeats:YES];

and in the location delegate I am calling a web request for updating the location in server, to track the user.

Will apple reject the app for using the location update background mode.

Dipin
  • 51
  • 1
  • 6

2 Answers2

1
Will apple reject the app for using the location update background mode.

According to the Apple Documentation you are only allowed to if your iOS App

Playing and Recording Background Audio An app that plays or records audio continuously (even while the app is running in the background) can register to perform those tasks in the background.Tracking the User’s Location and Implementing a VoIP Client (Voice over Internet Protocol). So Accordingly no problem at all but the final result will be declared by Apple Review Team

Good Luck

Buntylm
  • 7,345
  • 1
  • 31
  • 51
1

Apple will reject application if you start or stop location update while application is in background.

But you can get latest location update in background with method "startMonitoringSignificantLocationChanges". It will update current location value when app is in background and when you will come in foreground mode, You will have latest location information to perform any subsequence activity.

  • Yes, this is the recommended way to go. However, the way Significant Location Change monitoring works has changed in iOS7: http://stackoverflow.com/questions/18639976/significant-blocation-change-event-in-ios7-background-service-call so you will not be able to track the user's position unless your app has not been killed either by the user or the operating system :( – lnjuanj Apr 04 '14 at 08:10