Aris
Aris

Reputation: 1559

Background Scan for 32-bit UUID Service in iOS

I am trying to scan for a service with a 32-bit UUID while in the background.

Same code works as expected for a 128 bit UUID in foreground and background.

The scan for 32-bit UUID only works while the app is in foreground.

Is there a limitation that says that the UUID must be 128-bit?

Upvotes: 1

Views: 677

Answers (1)

Antoni Kedracki
Antoni Kedracki

Reputation: 159

Support for 32-bit UUIDs in LE mode was introduced in Bluetooth 4.1 (see revision history BLUETOOTH SPECIFICATION Version 4.1 [Vol 0]). As for Apple: they never announced an updated of CoreBluetooth to support it (e.g. CBUUID documentation mentions the Bluetooth 4.0 specification). So the short answer: yes, they must be 16-bit or 128-bit to be sure.

As for the reason: from my experience iOS is very picky when it comes to scanning in the background. Namely they sometimes only perform passive scanning. So depending on how your BLE peripheral splits the advertisement data into the ADV_IND and SCAN_RSP packets, you may see your 32-bit UUID or not. I would recommend you look at the advertisement data (and how it's divided into packets) with a BLE sniffer.

Upvotes: 3

Related Questions