How to allow my app to receive BLE data from sensor while running in background?

I have a sensor that communicates via BLE periodically. The intention is for it to be a set it and forget it kind of thing. The user will check the app periodically but won't be doing so frequently. I need the app to be able to still receive the BLE data from the sensor even if it's running in the background so that when the user does check the app, they can see everything that's been happening.

I've read a lot from 2020 - 2021 where it seems many developers are struggling with the same issue.

Is there a supported way to do this now? How to have my app run in the background and still be able to receive BLE data?

If your intention is to have your app listen to changing advertisements from a peripheral without connecting to it, this is not possible when the app is in the background.

When in the background, the app will be given a didDiscover() callback only once per peripheral, and then if you want to interact with it or receive data from it, you would need to connect and read from a characteristic.


Argun Tekant /  DTS Engineer / Core Technologies

How to allow my app to receive BLE data from sensor while running in background?
 
 
Q