Ios Peripheral Device in BACKGROUND

2020-07-20 04:36发布

问题:

We need in our project to detect the proximity of an iPhone that is running a custom APP that is using Bluetooth LE.

The detector (Scanner, Central...) will be implemented using a BLE Integrated Circuit (from Texas or Nordic). I mean that the scanner is not another IOS device... running Core Bluetooth as a Central..

For the detector to guess the proximity, the idea is very simple, just advertise a service with an UUID proprietary.

While in foreground all works OK, and the UUID and a Local name are advertised (The UUID in the main advertise packet, and the Local Name in the SCAN Response packet....), and our scanner is able to decide if this iOS device is running our App.

The problem arises when going to background .....

The iOS stops broadcasting UUID and Local Name. (As the documentation of Core Bluetooth Explains... I Know...)

At this moment (Background), IOS begin to broadcast a SPECIAL MANUFACTURER DATA in the main advertise packet, and nothing in the SCAN Response packet)

The data packet we see using a Bluetooth Sniffer is :

0x14 (length of packet not including this byte). 0xFF (Manufacturer specific data AD Type).

And then :

0x4C, 0x00 (this data is the manufacturer identifier, if the packet is compliant with BLE 4.0 specification). 0x01, 0x00,0x00, 0x00, 0x00,0x00,0x80, and ten 0x00 more....

I know Apple says that while in background ONLY ANOTHER IOS DEVICE SEARCHING FOR A SPECIFIC SERVICE CAN DISCOVER IT. (Really I do not know how they can achieve that, unless they connect to the peripheral and retrieve the services, or if the peripheral knows about other IOS device is scanning because of it´s Address in the SCAN REQUEST and then changes the advertisement data in background).

The main questions are :

Is there any documentation or knowledge of what this manufacturer data means....Perhaps it would be possible to the scanner to know based on this info that this is an iOS device advertising in background and then connect to look if the custom service is there. (Not a quick and clean solution...but I do not see any other workaround....)

Does anybody worked with this scenario...and found a clean solution .....

I have heard from people that forces the application not to go to background.

This limitation, will stop a lot of possible projects.