Reputation: 2939
I currently can fetchUuidsWithSdp
of a remote device. (getUuids
doesn't work, not sure why)
But how could I get the UUIDs of my own android device?
It is supposed that when I successfully execute accept()
upon a server socket the registered UUIDs must include the UUID I established upon the creation of the server socket with this command listenUsingInsecureRfcommWithServiceRecord
I discovered this is not always the case! I would like to test it..
Upvotes: 0
Views: 1437
Reputation: 451
Hey a Little Late but the best method I found is to do something like this. I isn't neccesary the best idea for production code but for testing it's not bad.
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Method getUUIDsMethod = BluetoothAdapter.class.getDeclaredMethod("getUuids", null);
ParcelUuid[] dUUIDs = (ParcelUuid[]) getUUIDsMethod.invoke(mBluetoothAdapter, null);
Hope this helps
Upvotes: 1
Reputation: 411
TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String uuid = tManager.getDeviceId();
//or
UUID.nameUUIDFromBytes(tManager.getDeviceId().getBytes("utf8"))
Upvotes: 0