Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a unique identifier for a Bluetooth device accessible to iOS and Android without connecting?

We are creating a bluetooth hardware device and want to store a unique identifier in the database so that multiple users won't try to connect to the same device. There is an Android and an iOS app.

It is my understanding that in iOS you can't access the MAC Address and the UUID provided is generated on the iOS side. We can add a characteristic providing a UUID, but is there a way to have a consistent identifier on iOS and Android without connecting to the bluetooth device?

like image 204
Jeremiah Avatar asked Dec 17 '15 16:12

Jeremiah


1 Answers

If you have control over the hardware and what it advertises then you can include the mac address (or some other unique identifier) as service data or manufacturer-specific data. See https://developer.android.com/reference/android/bluetooth/le/ScanRecord.html on Android L or above. For lower Android versions you have to parse the scan record yourself, which is a bit of a pain.

For iOS see here: https://stackoverflow.com/a/25392156/4248895

For a quick proof of concept on Android you can use SweetBlue which handles the different OS versions for you under the hood. See:

http://idevicesinc.com/sweetblue/docs/api/com/idevicesinc/sweetblue/BleManagerConfig.ScanFilter.ScanEvent.html#serviceData
http://idevicesinc.com/sweetblue/docs/api/com/idevicesinc/sweetblue/BleManagerConfig.ScanFilter.ScanEvent.html#manufacturerData

like image 76
Doug Koellmer Avatar answered Sep 28 '22 05:09

Doug Koellmer