Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Under what conditions Core Bluetooth restoration works?

I use state preservation and restoration. After simulating memory pressure using kill(getpid(), SIGKILL); , the app is killed and then is woken up, I receive notifications from the CBCentralManagerDelegate and I can communicate with peripherals.

Should restoration works after:

  1. iOS reboot?
  2. the user kills the app from the multitasking bar?

According to posts like this: Long-Term Actions after app is killed, point 2 could not be possible.

  1. If restoration does not work for 1 or 2 points, how could I "reconnet" to my peripherals in these situations?
like image 208
Maria Avatar asked Sep 30 '14 11:09

Maria


1 Answers

Restoration works for cases when the app is killed by the OS:

  • call kill(getpid(), SIGKILL)
  • OS kills while in background

In any other cases, the app is not restored. The reason behind it is probably the intention that the user wanted to kill the app so it should not be re-launched. This may not be true for reboot but Apple has treated it that way so far.

No reports have shown changes so far in iOS 8 regarding the restart after reboot behavior.

There is no way to restart after a taskbar kill but for the reboot there is an alternative solution. You can register for significant location changes which will to restore the app after reboot. This has worked for me very reliably.

like image 178
allprog Avatar answered Nov 25 '22 19:11

allprog