Grigory
Grigory

Reputation: 1024

Return app to background for bluetooth event handling after manual app termination

I'm implementing a programmable BLE button. I've managed to implement the scenario when the app is terminated by the system and then when I press the button the bluetooth central manager restores its state with the centralManager(_:willRestoreState:): method. The peripheral is connected and all the services are visible. But this happens only after I emulate the app termination via kill(getpid(), SIGKILL).

But. When I terminated the app via double clicking the Home button and swiping the app off the screen the centralManager(_:willRestoreState:): is not called and the app is not returned to the background.

Why is that? It turns out that termination of an app with the ios itself and the manual termination of an app are different things.

So how can I make so that the app is returned to background not only after ios app termination but also after manual termination?

Upvotes: 0

Views: 355

Answers (1)

psci
psci

Reputation: 933

This is desired behaviour. IMO there is no way to work around. If user swipe up your application in the app switcher, that means that he/she don't wont to be bothering by app anymore. This is Apple way to respect user's privacy.

The same thing with remote notifications.

Upvotes: 1

Related Questions