Re: Background and locked iOS device BTLE scanning behavior changes in iOS 7
Re: Background and locked iOS device BTLE scanning behavior changes in iOS 7
- Subject: Re: Background and locked iOS device BTLE scanning behavior changes in iOS 7
- From: William Henderson <email@hidden>
- Date: Sat, 28 Sep 2013 10:05:43 -0700
Hi Brian,
I'm surprised you had this working on iOS 6. Based on my testing, this never worked. What I can tell you is that whenever an iOS device goes into the background, it changes its advertisement packets to not include any service UUIDs. This is documented in the CoreBluetooth Programming Guide:
All service UUIDs contained in the value of the CBAdvertisementDataServiceUUIDsKey advertisement key are placed in a special “overflow” area; they can be discovered only by an iOS device that is explicitly scanning for them.
What I've found is that the only way for an iOS device or Mac to find a backgrounded iOS device is to have the scanning device scan for all services (i.e. pass nil to scanForPeripheralsWithServices:). And, as has been discussed elsewhere on this list, scanning in the background only works if you explicitly pass an array of services into scanForPeripheralsWithServices.
In sum, as far as I know you can't do background-to-background iOS device discovery – both central and peripherals exhibit special behaviors while in the background that make this impossible. As you say, it's possible when one device is in the foreground, one device is a hardware peripheral, or the central is a Mac (OS X doesn't yet have 'background' mode). I'm unclear whether this is intentional or not. The CB Programming Guide seems to imply that background to background should be possible, but my findings and prior discussion on the list has indicated the opposite.
On Friday, September 27, 2013 at 9:06 PM, Brian Fudge wrote:
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden