BluetoothDevice.DisconnectAcl(BluetoothTransports) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
断开此设备的 ACL 链接的连接。
[Android.Runtime.Register("disconnectAcl", "(I)I", "", ApiSince=37)]
public Android.Bluetooth.CurrentBluetoothStatusCodes DisconnectAcl(Android.Bluetooth.BluetoothTransports transport);
[<Android.Runtime.Register("disconnectAcl", "(I)I", "", ApiSince=37)>]
member this.DisconnectAcl : Android.Bluetooth.BluetoothTransports -> Android.Bluetooth.CurrentBluetoothStatusCodes
参数
- transport
- BluetoothTransports
要断开连接的传输(例如#TRANSPORT_AUTO, #TRANSPORT_BREDR#TRANSPORT_LE)
返回
BluetoothStatusCodes#SUCCESS 成功设置时,否则为错误代码。
- 特性
注解
断开此设备的 ACL 链接的连接。
如果传输TRANSPORT_AUTO,它将断开设备的所有 ACL 链接。 否则,它会断开指定传输的 ACL 链接的连接。
断开连接是异步的,因此应用应侦听ACTION_ACL_DISCONNECTED以验证断开连接是否成功。
此方法要求调用应用具有Manifest.permission.BLUETOOTH_CONNECT权限。 此外,应用必须具有Manifest.permission.BLUETOOTH_PRIVILEGED或与此设备有配套设备管理器关联(请参阅 android.companion.CompanionDeviceManager.associate(AssociationRequest,android.companion.CompanionDeviceManager.Callback,Handler))。 对于面向Build.VERSION_CODES的应用。S 或更高版本,这需要Manifest.permission.BLUETOOTH_CONNECT权限,android.app.Activity.requestPermissions(String[],int) 获得的权限。
Android 参考。android.bluetooth.BluetoothDevice.disconnectAcl
本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。