Hi Apple Team,
Thank you for your response. I’d like to clarify the steps we’ve taken regarding background BLE scanning, as well as address the points you raised.
We are working with Custom Ruuvi BLE devices that emit advertisement packets containing data such as Temperature, Humidity, RSSI, MAC Address, Payload Data, Pressure, Device Name, and more.
We initially developed a Swift iOS application that scans these peripheral devices and captures the above data in foreground mode. Since this data was not available in background mode, we implemented Picture-in-Picture (PIP) mode, which allowed us to keep scanning in the background, provided that a PIP window was open.
After releasing the build on TestFlight, we received feedback from the client that another vendor was able to collect data in background mode without using PIP mode by using a Service UUID instead of a Manufacturer UUID for filtering out the peripheral devices to display in their application. This vendor is using the CoreBluetooth API, not CoreLocation (i.e., these are not iBeacons), to scan for BLE devices.
Upon learning this, we modified our approach to use the Service UUID in the scanForPeripherals(withServices:options:) method as follows:
scanForPeripherals(withServices: [serviceUUID], options: [
CBCentralManagerScanOptionAllowDuplicatesKey: true
])
The UUID we are passing to scanForPeripherals(withServices:options:) is the Service UUID that is being advertised by the Ruuvi devices.
Despite this change, we are still unable to receive the advertisement packet data in background mode.
To Address Your Questions:
We are using the Service UUID for scanning and not using any filters based on a Manufacturer UUID at this point.
These are not iBeacons, and we are using CoreBluetooth APIs, not CoreLocation.
Regarding how the beacons are advertising: The Ruuvi devices advertise their data via Manufacturer Specific Data in the advertisement packet. However, to adhere to iOS background scanning limitations, we switched to using a Service UUID for scanning in the background. Despite this, the expected data is still not appearing in background mode.
What’s Not Adding Up:
The issue seems to be that even after updating the code to scan using the Service UUID, the BLE advertisement packets (containing Temperature, Humidity, and other data) are still not received in the background mode. We’re trying to determine whether the problem lies in the way the Ruuvi devices advertise, or if there is a deeper limitation in iOS background scanning.
We’d appreciate any insights or recommendations on how to resolve this issue. We’ll continue investigating and provide further updates as we progress.
I have also attached the code snippet so that you can through the code once, what mistakes we are making.
Thank you for your time, and we look forward to hearing your thoughts.
Best regards,
Sanket Jain
ViewController.swift
Topic:
App & System Services
SubTopic:
Core OS
Tags: