App scans the BLE device(Mokobeacon) in foreground mode. Scan, connect and disconnect work well in foreground. Scanning using this.manager.ScanForPeripherals(CBUUID.FromString("FF01"))
and devices available at void DiscoveredPeripheral(object sender, CBDiscoveredPeripheralEventArgs args)
method. But scan will not start when the app is in background, when app comes to foreground, scan works and DiscoveredPeripheral
hits, connect and disconnect will work. I'm using iphone 13.6 . Background options enabled in info.plist also(both bluetooth central and peripheral) .Scan works in both modes for android;no issues there. Is there any restriction for ios for not to scan in background? help appreciated...
Asked
Active
Viewed 399 times
0

Vipin Krishna
- 355
- 1
- 4
- 25
-
The service UUID that you are scanning for must be in the device's advertising packet. – SushiHangover Aug 27 '20 at 19:58
-
I tried with service data from advertising. Is the same as service uuid? how to get that service uuid? – Vipin Krishna Aug 27 '20 at 20:06
-
https://medium.com/@cbartel/ios-scan-and-connect-to-a-ble-peripheral-in-the-background-731f960d520d / https://stackoverflow.com/questions/32140863/ios-diddiscoverperipheral-not-called-in-background-mode – SushiHangover Aug 27 '20 at 20:16
-
@SushiHangover tried with service uuid 0xFF01 got from nrf mobile app. still background scanning not working – Vipin Krishna Aug 28 '20 at 18:42
-
That is not a 128b service id, you should read the full medium article that explains what the service id is, how to find it via wireshark and how to make sure that your device is returning it in the advertisement packet and not in the scan packet. – SushiHangover Aug 28 '20 at 19:01
-
Got from nrf. serviceid: 0000ff01-0000-1000-8000-00805f9b34fb . but no improvement. still need to launch – Vipin Krishna Aug 28 '20 at 19:43
-
Sounds like it is not returning that in the advertisement packet (that is what iOS requires for background scanning), Wireshark it to see what it is returning. – SushiHangover Aug 28 '20 at 19:48