Device.bluetoothUnpairDevice()
Overview
Removes the system pairing for a specific Bluetooth device.
Added in version 2.1.33
Android only
Format
var available = Device.bluetoothUnpairDevice(address);
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
address | The MAC address of the device to unpair. | String | Required | The MAC address must be six hex octets separated by colons. The hex must use uppercase digits, or the failure will be logged and the requests ignored. |
available | Indicates if the unpair process is available. | Boolean | Return value | A false return value indicates unpairing is unavailable at this time. |
Example 1
Copy
/* Tries to unpair the Bluetooth device "00:11:22:AA:BB:CC" when the F1 key is pressed.
* Logs information on success or failure.
*/
WLEvent.onKey(0xE03B, function(event) {
var available = Device.bluetoothUnpairDevice("00:11:22:AA:BB:CC");
if(!available) {
Logger.error("Cannot unpair right now");
}
event.eventHandled = true;
});
Example 2
Copy
/* Tries to unpair all Bluetooth devices.
* Logs information on success or failure.
*/
var paired = Device.bluetoothGetPaired();
if(paired) {
for(var i=0; i < paired.length; i++) {
if(paired[i].address) {
Device.bluetoothUnpairDevice(paired[i].address);
}
}
} else {
Logger.warn("Cannot get list of devices");
}