Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Initialize the Bluetooth adapter.
true
my.openBluetoothAdapter({ success(res) { if (!res.isSupportBLE) { console.log('Bluetooth is unavailable temporarily'); return; } console.log('Bluetooth adapter initialized'); }, fail(err) { console.error('Failed to initialize Bluetooth:', err); } });
Page({ onLoad() { this.initBluetooth(); }, initBluetooth() { my.openBluetoothAdapter({ success: () => { console.log('Bluetooth ready'); this.setData({ bluetoothReady: true }); }, fail: (err) => { if (err.error === 10001) { my.alert({ title: 'Bluetooth Required', content: 'Please enable Bluetooth to use this feature.' }); } } }); }, onUnload() { my.closeBluetoothAdapter(); } });
my.closeBluetoothAdapter