How does Wechat jssdk detect whether Bluetooth is on and Bluetooth status update

problem description

how does Wechat jssdk detect whether Bluetooth is on and Bluetooth status update

the environmental background of the problems and what methods you have tried

need to check the status of Bluetooth in the project. Try onWXDeviceBluetoothStateChange this api, but cannot trigger it.

related codes

wx.ready(() => {
wx.on("onWXDeviceBluetoothStateChange", (data) => console.log("", data));
wx.invoke("openBluetoothAdapter", {
                complete: () => {
                    wx.on("onWXDeviceBluetoothStateChange", (data) => console.log(data));
                }
            });
wx.invoke("getBluetoothAdapterState", {
                complete: (data) => {
                    console.log("", data);
                }
            });
})
// jsApiList

landlord, take a look at this article Portal . I hope it will be helpful to you.

Menu