跳至主要內容

BluetoothDevice.forget()

BFChaininterfaceBluetoothDeviceforget小于 1 分钟

BluetoothDevice.forget() 用来忽略当前蓝牙设备

BluetoothDevice.forget()

参数

返回值

返回一个 Promise对象,resolve兑现一个BluetoothForgetResponse对象;

示例

  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){
      // 成功的查询和连接了蓝牙设备;
      const bluetoothDevice = res.data.device;
      return bluetoothDevice
    }
  })
  .then(bluetoothDevice => {
    BluetoothDevice.forget()
  })
  .catch(err => console.error(err))

平台兼容性

属性/方法/事件AndroidIOSDesktop-DevDesktop
forgetX

相关链接

BluetoothDevice

评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v2.15.7