Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt

Use this file to discover all available pages before exploring further.

Use this API to stop listening for Bluetooth device discovery events that were registered with my.onBluetoothDeviceFound().

Parameters

PropertyTypeRequiredDescription
callbackFunctionNoThe specific callback to remove. If omitted, all listeners are removed.

Code Example

Remove All Listeners

my.offBluetoothDeviceFound();

Remove Specific Listener

Page({
  onLoad() {
    my.onBluetoothDeviceFound(this.handleDeviceFound);
  },

  handleDeviceFound(res) {
    console.log('Devices found:', res.devices);
  },

  onUnload() {
    my.offBluetoothDeviceFound(this.handleDeviceFound);
    my.closeBluetoothAdapter();
  }
});

Complete Cleanup

Page({
  onUnload() {
    // Stop discovery
    my.stopBluetoothDevicesDiscovery();

    // Remove listeners
    my.offBluetoothDeviceFound();
    my.offBluetoothAdapterStateChange();

    // Close adapter
    my.closeBluetoothAdapter();
  }
});

my.onBluetoothDeviceFound

Listen for devices

my.stopBluetoothDevicesDiscovery

Stop discovery