HomeDocs
Skip to main content

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​

PropertyTypeDescription
availablebooleanWhether the Bluetooth adapter is available
discoveringbooleanWhether 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.

Privacy agreementDeveloper agreementcontact us: developer_private.mi@dlightek.com © 2024 MiniApp. All Rights Reserved.