Home > Mobile >  Remove the bluetooth paired device is not successful
Remove the bluetooth paired device is not successful

Time:10-26

On the Internet, use the way to remove has paired device, huawei mobile phone test no problem, but the millet mobile phone no,
Private static void removePairDevice () {
BluetoothAdapter mBluetoothAdapter=BluetoothAdapter. GetDefaultAdapter ();
If (mBluetoothAdapter getState ()==BluetoothAdapter. STATE_OFF) {
MBluetoothAdapter. The enable ();
Try {
Thread.sleep (3000);
{} catch InterruptedException (e)
e.printStackTrace();
}
}
If (mBluetoothAdapter!=null) {
Set BondedDevices=mBluetoothAdapter. GetBondedDevices ();
For (BluetoothDevice device: bondedDevices) {
UnpairDevice (device);
}
}
}

Private static void unpairDevice (BluetoothDevice device) {
Try {
Method m=device getClass (). GetMethod (" removeBond ", (Class []) null);
M.i nvoke (device, (Object []) null);//remove fails, return false.
} the catch (Exception e) {
The e (TAG, um participant etMessage ());
}
}

Are there any other way?
  • Related