I am new in the World of mobile Testing.
I am starting an App and testing it with appium Syntax. But i want to remove all Bluetooth Bindings before i start my Test. I found this Code for Android but i dont know how i can implement this in My Test.
public static void clearBondings() {
Set<BluetoothDevice> bondedDevices = BluetoothAdapter
.getDefaultAdapter().getBondedDevices();
try {
Class<?> btDeviceInstance = Class.forName(BluetoothDevice.class
.getCanonicalName());
Method removeBondMethod = btDeviceInstance.getMethod("removeBond");
boolean cleared = false;
for (BluetoothDevice bluetoothDevice : bondedDevices) {
if(bluetoothDevice.getName().contains("OB_")) {
String mac = bluetoothDevice.getAddress();
removeBondMethod.invoke(bluetoothDevice);
}
cleared = true;
}
if (!cleared) {
}
} catch (Throwable th) {
}
}
I would be glad, if someone can help me. My Appium Code is also in Java