I am doing carplay connection work. When connecting to a Bluetooth device, I found that the UUID of the device changed before and after binding.My car system is based on android12.
logs:
//During the binding process, the device’s uuid contains the UUID needed to connect to Carplay.
04-11 13:00:31.028 6521 6521 D BluetoothManager: bluetoothReceiver ACTION_BOND_STATE_CHANGED, device: Sereah’s iPhone
04-11 13:00:31.029 6521 6521 D BluetoothManager: notifyBtBondState state: 11, address: 38:9C:B2:B3:6E:BE, devUuids: 00000000-deca-fade-deca-deafdecacafe,02030302-1d19-415f-86f2-22a2106a0a77,2d8d2466-e14d-451c-88bc-7301abea291a
//After the device is successfully bound, the uuid has changed and does not contain the uuid required for carplay connection.
BluetoothManager: bluetoothReceiver ACTION_BOND_STATE_CHANGED, device: Sereah’s iPhone
BluetoothManager: notifyBtBondState state: 12, address: 38:9C:B2:B3:6E:BE, devUuids: 00001200-0000-1000-8000-00805f9b34fb,0000111f-0000-1000-8000-00805f9b34fb,0000112f-0000-1000-8000-00805f9b34fb,0000110a-0000-1000-8000-00805f9b34fb,0000110c-0000-1000-8000-00805f9b34fb,00001116-0000-1000-8000-00805f9b34fb,00001132-0000-1000-8000-00805f9b34fb,00001801-0000-1000-8000-00805f9b34fb
My codes:
case BluetoothDevice.ACTION_BOND_STATE_CHANGED:
int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_NONE);
LogPrint.Debug(TAG, "bluetoothReceiver ACTION_BOND_STATE_CHANGED, device: " + extraDevice.getName());
extraDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (extraDevice == null) {
return;
}
notifyBtBondState(bondState, deviceAddress, Utils.parcelableToString(extraDevice.getUuids()));
break;
After the binding is successful, I need to use the UUID to determine whether the current device can be connected to the CP wireless connection, but it is currently blocked due to this problem. I want to know the reason why the UUID changes?
Sereah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.