I am part of a team that is building a product line with a bluetooth device that requires us to use background bluetooth scanning. The device sends BLE packets periodically and the phone receives these packets and sends the data to our DB. We were able to get background bluetooth packets receiving (although sporadically) on the phone. However we cannot receive any packets while the app is backgrounded and the phone is locked.
So my question is two fold:
This is more critical: Is there any way to allow scanning while the app is backgrounded and the phone is locked?
This is secondary: Is there anyway to make background scanning more reliable/predictable so that we can get consistent readings in the background
Yes, CoreBluetooth is designed to work while the app is in the background. Be sure to check the appropriate background mode capability in your target's capabilities tab. Watch some of the old WWDC videos on Core Bluetooth. There are limitations in background, i.e. you must be scanning for one or more UUIDs--scans without CBUUID's do not invoke callbacks when the app is in the background state. Based on what you've described sounds like you'd want to check the box "Uses Bluetooth LE accessories".
As far as predictable in background goes, this is an older doc but should still apply. Please refer to the Bluetooth accessory guidelines. Take note of the advertisement intervals that are recommended to aid with background discovery.
I will make the assumption that your BLE product advertises frequently and the app would connect and then retrieve data from the device? OR your advertisement payload contains the data you're looking for?