0

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..

George Pligoropoulos
  • 2,919
  • 3
  • 33
  • 65

2 Answers2

1

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

Marcus Karpoff
  • 451
  • 5
  • 16
0
 TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
 String uuid = tManager.getDeviceId();
//or
UUID.nameUUIDFromBytes(tManager.getDeviceId().getBytes("utf8"))
Deepak Ramesh
  • 403
  • 1
  • 5
  • 13