Android Question Bluetooth unpair

Firpas

Active Member
Licensed User
Longtime User
Hello everyone:

Does anyone know the answer to this?

When I connect to a device via bluetooth using BluetoothAdmin Lib, the device is automatically paired.

Is it possible to unpair it from B4A code, once the communication finished?

Thanks in advance
 
There is no public API for this in Android. You can call a hidden method with this code:
Code:
Sub UnpairDevice(Address As String)
   Dim adapter As JavaObject
   adapter = adapter.InitializeStatic("android.bluetooth.BluetoothAdapter").RunMethod("getDefaultAdapter", Null)
   Dim device As JavaObject = adapter.RunMethod("getRemoteDevice", Array(Address))
   Log(device.RunMethod("removeBond", Null))
End Sub
 
Upvote 0
Back
Top