To establish a socket connection to my device via bluetooth I need to get the UUID of the "server".
On the client side I can get the UUID's through the getUuids() method of BlueToothDevice
getUuids() Returns the supported features (UUID) of the remote device.
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
ParcelUuid[] uuids = device.getUuids();
But I want to get the UUID
same device. On investigation there is actually no SDK exposed method for this purpose.
Is there an option?
Obtaining the UUIDs assigned to the device can be obtained by "reflection" using the same getUuids() method , for this we must have BlueTooth enabled on our device.
In this way you can obtain the UUID(s) related to the device with the following format:
this to be used as identifier:
Don't forget to declare the permission inside the file
AndroidManifest.xml
try: