0

I have my app enabled for location services in background, but this is an option I offer to users: I mean, I have a settings option within my app that allows users to continue tracking locations in background or not. If user enables this option in my app and goes to background, and once in the background, she disables location services in the Settings app of the device, and she enables them again, I see that she needs to make the app active again to restart the locations listening in my app.

Is there any way to restart it while in background? I need this to work in iOS 6.0+

Thanks in advance

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
AppsDev
  • 12,319
  • 23
  • 93
  • 186

1 Answers1

0

try

public override void DidEnterBackground (UIApplication application) {
  int taskID = UIApplication.SharedApplication.BeginBackgroundTask( () => {});
  new Task ( () => {
    DoWork();
    //UIApplication.SharedApplication.EndBackgroundTask(taskID);
  }).Start();
}

To check for multitasking support so that application behavior can be modified to compensate for the missing functionality:

- (BOOL)multitaskingAvailable
{
  UIDevice *device = [UIDevice currentDevice];
  BOOL areBackgroundTasksSupported = NO;
  if ([device respondsToSelector:
      @selector(isMultitaskingSupported)])
       areBackgroundTasksSupported = device.multitaskingSupported;
  return areBackgroundTasksSupported;
}

Source

Alex Zavatone
  • 4,106
  • 36
  • 54
Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81