Run custom code on BLE beacon event

Hello everyone,

I am currently working on a project for the health sector. Basically we have some Bluetooth low energy devices that have a button.

When this button is pressed (usually for emergency situation), this event should alert our backend and therefore send help.

Is it technically possible to do this on IOS?

I am aware that apple have very strict restrictions in relation to background services, and after doing some research I found that it's impossible to run any custom code if the app is terminated by the user.

Is there a way to make a request for such special cases so that apple allows us to actually launch the app (or if not possible send a http request) when this beacon button is pressed (Of course with the bluetooth device already connected to the Iphone) even if the app is completely terminated.

Thanks :)

If you are using CoreBluetooth to connect and interact with your "beacon", an app being terminated by the user is an irrecoverable action, and your app will not function until the user first launches it again.

There is no request to be made to go around this behavior.

But if you would be able to convert your "beacon" into an iBeacon, then you would be able to use CoreLocation APIs to detect it when it comes online from a button press, and that would work even if the app was terminated by the user.

Of course, there are some limitations to this. An iBeacon is just a "beacon" that advertises its presence. It cannot be connected to in order to transfer or obtain other data.

While you may be able to find "iBeacons" that advertise as connectable, by definition they are not spec compliant, and your success in using them may vary.

You may find it an easier and a more successful solution to educate your users to not terminate the app for such a critical function.


Argun Tekant /  DTS Engineer / Core Technologies

Run custom code on BLE beacon event
 
 
Q