Skip to main content

BluetoothDevice.watchAdvertisements()

BFChaininterfaceBluetoothDevicewatchAdvertisementsLess than 1 minute

BluetoothDevice.watchAdvertisements() is used to ignore the current Bluetooth device

BluetoothDevice.watchAdvertisements()

parameters

  • none

return value

Return a Promise object, and resolve fulfills a BluetoothWatchAdvertisementsResponse object;

Example

  import { bluetoothPlugin } from "@plaoc/plugins";

  bluetoothPlugin
  .open()
  .then(res => {
    if(res.success){
      const options = {
        acceptAllDevices: true,
        optionalServices: ["00003802-0000-1000-8000-00805f9b34fb"],
      }
      return bluetoothPlugin.requestAndConnectDevice(options)
    }
  })
  .then(res => {
    if(res.success){
      // successfully query and connect the bluetooth device;
      const bluetoothDevice = res.data.device;
      return bluetoothDevice
    }
  })
  .then(bluetoothDevice => {
    BluetoothDevice.watchAdvertisements()
  })
  .catch(err => console.error(err))

Platform Compatibility

Property/Method/EventAndroidIOSDesktop-DevDesktop
watchAdvertisementsX

BluetoothDevice

Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v2.15.7