Reputation: 395
I have two BLE peripherals (iOS and Android) and an Macbook which is the central.
I already succeed to connect, write, read and notify but I have a problem with the Android's peripheral UUID.
On central didDiscoverPeripheral
method (central) the UUID of my Android device is never the same after application's reboot.
I need to identify devices but I can't if the UUID always change..
Do you have any ideas ?
Upvotes: 0
Views: 1301
Reputation: 1829
Android's peripheral mode will change its mac address every time when you call BluetoothLeAdvertiser.startAdvertising(). This is a security measure and you cannot disable it, you can read more in this so question.
On iOS/Mac OS, CoreBluetooth will generate UUID for scanned peripheral from the advertisement data and one of the known factor is the mac address of the peripheral. So if the Android peripheral changes its mac address, you have no way to stop the UUID change on the Mac central.
I suggest you to add some data in the advertisement data of your Android peripheral, which helps you to identify it.
Upvotes: 2