we are developing an app that should respond to an iBeacon also in background. We have developed a small device carried on a sporting tool (sorry, can't be more specific due to NDA) that can be activated by pushing a button.
Once the user pushes the button the device turns on (gives current) to a small BLE iBeacon that will emit 10 iBeacon signals, broadcasting for 2 millisecs, 10 times (so the overall elapsed time for each pressure is 10 seconds).
The device, since it's on a sporting tool used by the user, is never more than 2 meters from the iOS device.
Of course this is not the usual iBeacon use case, but it's similar: when the user pushes the button, the device emits iBeacon packets, and the iOS device magically finds itself INSIDE the iBeacon range. AFter the device stops transmitting, after a while, the iOS device detects the exiting from the range. This is our expected behaviour.
By using other commercial BLE apps we can detect it correctly (for example the app by Nordic, nRF connect. Or others.
So far, by using CoreLocation and RegionMonitoring with the correct iBeacon UUID, our app is able to detect the transmission of iBeacon packets (by pushing the device button):
- always, while in foreground
- most of the times, but not always, when app is in background
- sometimes after iOS reboot or app kill
- after rebooting the iOS device, it helps to actually open your iPhone and do something for a while (i.e. look at a Whatsapp msg) before detecting the beacon
Any idea? We are working to increase the period of time when the iBeacon packet is sent, i.e. up to 30 seconds.
It seems to me that the background scanning of regions is given low priority sometimes, and we broadcast our signal for a too short period of time?
Could it be the problem?