Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch app in background when BLE device is in range

I'm making an iOS app to support a Bluetooth LE device. First time the app launches, we pair, but after that I want to communicate with the device whenever it is in range. Using background modes, this works fine for when the app is launched and goes into background and the screen is turned off. But, when the phone is rebooted, the app needs to be relaunched before it will be able to detect the device.

Is there any way to have the app launch in the background whenever the BLE device that it is paired to comes nearby?

like image 865
niklassaers Avatar asked Oct 23 '25 18:10

niklassaers


1 Answers

In case of user forcibly kills the app by double clicking on home button and swipe out, it will not be relaunched until the user launches it again.

Coming to your case when Device is rebooted - Yes, you can configure State Preservation and Restoration to relaunch the app when user has not killed it forcibly before rebooting.
( Note: If the device requires a passcode to unlock, apps will not be relaunched until the device is unlocked for the first time after a restart )

Also, it is important to keep in mind that the app will be relaunched and restored if and only if it is pending on a specific Bluetooth event or action (like scanning, connecting, or a subscribed notification characteristic), and this event has occurred.

For more info:
Conditions Under Which Bluetooth State Restoration Will Relaunch An App

like image 200
Prakash Shaiva Avatar answered Oct 26 '25 08:10

Prakash Shaiva



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!