Service Background Bluetooth can work even kill app

Hi,

I want to develop an application with service can discover neighbors devices bluetooth in background, this service can run even app was killed.

The scan of bluetooth start every 5 sec as service, and find Bluetooth device and can read data from BLE device.

It's possible with IOS?

any limitations?

Thank you

Regads,

Thuyet

Let's start with the desire to run even the app was killed. I assume you mean when the app is killed by the user. The system could also kill the app, for example if it needs resources that your app is using in the background.

If the system kills the app, you can continue working with Bluetooth devices. But if the user kills it, then the app will not function until it is manually launched again. User killing the app is considered a drastic choice by the user to say that they do not want the app to run, often because it misbehaved in some unrecoverable manner. Our recommendation would be to respect the users' choice on that matter and not try to find ways around this.

As for starting a scan every 5 seconds, this is not how Bluetooth works. My recommendation would be to read up on BLE scanning and connecting process, and also read Core Bluetooth Background Processing for iOS Apps to understand how you can implement what you need to do using the Core Bluetooth framework.


Argun Tekant /  DTS Engineer / Core Technologies

But is there anyway to register resources for app run in background when app was killed ? it can still connect with Bluetooth devices and read data from it.

The "Performing Long-Term Actions in the Background" chapter of the above documentation will explain how the app can continue to work after the system terminates it (or it crashes).

There's no solution for registering, saving, or continuing to use Bluetooth resources if the user kills it other than the user relaunching it manually.


Argun Tekant /  DTS Engineer / Core Technologies

Service Background Bluetooth can work even kill app
 
 
Q