I have an android phone and a barcode scanner. To use the scanner I pair it with the phone but in my application I want to a some point to disconnect the scanner, so to do this I thought that an unpair would be enough. I tried the accepted answer from here
but it doesn’t work. Maybe the BluetoothDevice object it’s not correct?
String mac = BluetoothAdapter.getDefaultAdapter().getAddress();
BluetoothDevice bluetoothDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(mac);
Actually I didn’t understand what address to put in getRemoteDevice() method so I put the phone bluetooth mac address. Should I put there other address? I would appreciate any answer.
Thank you in advance
once you select your scanner , you will be storing it in
then just fetch the address by using device.getAddress();
and if you are calling your unpair in different activity , then just pass the address as bundle and then fetch the remote device by using:
I hope this will work.