0
votes

I'm developing a iOS application which works as BLE Central. I want to relaunch the application, even after its termination, if it detects peripheral devices.

I created my central manager according to the Apple's programming guide in section "Performing Long-Term Actions in the Background". https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW1

But the app. relaunches only in particular condition.

  • Start [RUN] on Xcode and go into backgroud by pushing [HOME] of iPhone, then [STOP] on Xcode

In this case, my app relaunch ([application didFinishLaunchWithOption] and [central willRestoreState] is called) after peripheral device start advertising.

In the situations like below my app doesn't relaunch even after peripheral device start advertising.

  • Start [RUN] and [STOP] on Xcode (Stop when the app. is in foreground)
  • When the app. is in background, double click [HOME] on iPhone and terminate the app. by swiping upward.
  • After the reboot of iPhone

I'm creating and initiating my central manager normally.

    NSDictionary *options = @{
        CBCentralManagerOptionRestoreIdentifierKey : kBlitCentralMgrRestoreIdKey,
        CBCentralManagerOptionShowPowerAlertKey : @YES,
    };
     self.centralMgr = [[[CBCentralManager alloc] initWithDelegate:self queue:nil options:options] autorelease];

If you have any idea to resolve the issue, please let me know. I appreciate you kind cooperation.

1

1 Answers

0
votes

If you swipe the app from the App Switcher to kill it, the OS will not relaunch it. This is the same case with apps that rely on Background App Refresh.