dlt.onBluetoothAdapterStateChange(function listener)
Introduction
Listen for changes in the Bluetooth adapter's state.
Parameters
function listener
The listener function for the Bluetooth adapter's state change event.
Parameters
Object res
Property | Type | Description |
---|---|---|
available | boolean | Whether the Bluetooth adapter is available |
discovering | boolean | Whether the Bluetooth adapter is currently in the discovery state |
Sample Code
dlt.onBluetoothAdapterStateChange(function (res) {
console.log('adapterState changed, now is', res);
});
In the sample code provided, dlt.onBluetoothAdapterStateChange
is used to add a listener for changes in the Bluetooth adapter's state. When the adapter's state changes, the provided listener function is called, and it logs the new state information to the console.