harmony 鸿蒙@ohos.bluetooth (Bluetooth) (System API)

  • 2025-06-12
  • 浏览 (4)

@ohos.bluetooth (Bluetooth) (System API)

The Bluetooth module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.

NOTE The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. The APIs provided by this module are no longer maintained since API version 9. You are advised to use profile APIs of @ohos.bluetooth.ble. This topic describes only the system APIs provided by the module. For details about its public APIs, see @ohos.bluetooth (Bluetooth).

Modules to Import

import bluetooth from '@ohos.bluetooth';

bluetooth.cancelPairedDevice8+(deprecated)

cancelPairedDevice(deviceId: string): boolean

Cancels a paired remote device.

NOTE
This API is supported since API version 8 and deprecated since API version 9. Use bluetoothManager.cancelPairedDevice instead.

System API: This is a system API.

Required permissions: ohos.permission.DISCOVER_BLUETOOTH

System capability: SystemCapability.Communication.Bluetooth.Core

Parameters

Name Type Mandatory Description
deviceId string Yes Address of the remote device to cancel, for example, XX:XX:XX:XX:XX:XX.

Return value

Type Description
boolean Returns true if the operation is successful; returns false otherwise.

Example

let result : boolean = bluetooth.cancelPairedDevice("XX:XX:XX:XX:XX:XX");

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Connectivity Kit (Short-Range Communication Service)

harmony 鸿蒙Bluetooth

harmony 鸿蒙Wifi

harmony 鸿蒙Bluetooth Error Codes

harmony 鸿蒙NFC Error Codes

harmony 鸿蒙SecureElement Error Codes

harmony 鸿蒙Wi-Fi Error Codes

harmony 鸿蒙@ohos.bluetooth.a2dp (Bluetooth A2DP Module) (System API)

harmony 鸿蒙@ohos.bluetooth.a2dp (Bluetooth A2DP Module)

harmony 鸿蒙@ohos.bluetooth.access (Bluetooth Access Module) (System API)

0  赞