Post

Replies

Boosts

Views

Activity

Reply to BLE Scanning stops when phone is in locked mode
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
Oct ’24
Reply to BLE Scanning stops when phone is in locked mode
Can i get a response to above query, There is one more query: I got to know from client that when they are using Service UUID instead of Manufacturer UUID, the advertisement packets are getting catched in locked mode as well. So can you please validate that. Also, in our application we are passing a UUID to filter out the devices which we need to show in our application. Below is the UUID which we are using to filter out the beacons. Let me know if this is the Service UUID or Manufacturer UUID. UUID Example: 8EC90001-F315-4F60-9FB8-838830DAEA50 Please provide me a quick response to above query. As client Google is waiting for this response.
Oct ’24
Reply to BLE Scanning stops when phone is in locked mode
Our device is not an iBeacon device. It is a BLE Beacon Device. We are using CoreBluetooth in our application, we are expecting to see multiple advertisement packets which should contain manufacturing data of the device in background and locked mode. Currently we are getting manufacturing data in foreground. We are receiving manufacturing data in background just for 2-3 seconds after putting it in background/Locked mode. Also in Background we are getting characteristics data for single device. We are receiving characteristics data in background/locked mode which is not the data we are looking for, we need manufacturing data of the beacon device in background/Locked mode. We have put an email with same query, where we have got below reply. Pls consider that too while providing a solution. Please include the line below in follow-up emails for this request. Case-ID: 9114422 The actual answer depends on exactly what you mean by "scan not working" and what actually is happening with the scans, but in general when an app is in the background and/or the device is locked, Bluetooth scanning becomes very limited. If I understand your use case correctly, you are trying to read the manufacturer data from the advertising packets, which I presume is sending you some data that changes from packet to packet. This is not going to work unless your app is in the foreground. While foreground apps can detect every advertising packet, once they stop being active, they will be sent only ONE advertisement packet/data per device per scan. So, if you are trying to read changing data from advertisements, this will not work in the background. Your only option here is going to be to connect to the peripheral and have it write the changing data to a characteristic, from which your app will then read the data.
Sep ’24