I have a solution where my application should scan the Bluetooth enabled Beacon devices in the foreground, background, locked mode for the iphone.
Currently we have built the project, which is working fine in foreground mode. We have tried exploring multiple options to enable the feature in background and locked mode.
As of now, we have come up with the solution which implements Picture in Picture mode in the application and once the application is minimized. The PIP window opens which solves our problem. But the problem stays with locked mode. The scanning is not working in locked mode.
So can we know how the bluetooth scanning will work in background and locked mode. Please also mention the alternative solutions to the problem statement if background and locked mode scanning is not possible.
I have attached the project source code for reference.
This project is being built for Google, so it is bit urgent.
Can I expect a quick response to this query?
Depending on what your expectations are from the scanning and what the specifics are on the "Beacon device" you could be running into one or more of the following challenges when the app is not in the foreground:
1- if the device is an iBeacon device and you are using CoreLocation to scan instead of CoreBluetooth, you have to make sure the beacon device is 100% compatible with the iBeacon specs. Any variation will cause issues
2- for CoreBluetooth scanning, if you are expecting to see multiple advertisements in the background, this will not work, as apps in the background will only receive a single advertisement notification for each beacon device
3- if you are not able to receive any advertisements when in the background (rather than only one) then your beacon device may not be advertising properly. Please consult Accessory Design Guidelines for Apple Devices for the advertisement requirements for successful discovery
4- if you are receiving at least one advertisement, but not finding the data you are looking for, it could be that the data you are looking for is in the secondary advertisement packet (SCAN_RSP) which may be ignored when your app is not in the foreground.
If you can elaborate on what you are doing and what exact issue is, I can explain further and suggest workarounds if possible.
Argun Tekant / DTS Engineer / Core Technologies