Språk

BluetoothDevice.DisconnectAcl(BluetoothTransports) Method

Definition

Disconnects ACL links for this device.

[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

Parameters

transport
BluetoothTransports

the transport to disconnect (e.g. #TRANSPORT_AUTO, #TRANSPORT_BREDR, #TRANSPORT_LE)

Returns

BluetoothStatusCodes#SUCCESS upon successful setting, otherwise an error code.

Attributes

Remarks

Disconnects ACL links for this device.

If transport is TRANSPORT_AUTO, it disconnects all ACL links for the device. Otherwise, it disconnects the ACL link for the specified transport.

Disconnection is asynchronous, so apps should listen to ACTION_ACL_DISCONNECTED to verify whether disconnection was successful.

This method requires the calling app to have the Manifest.permission.BLUETOOTH_CONNECT permission. Additionally, an app must either have Manifest.permission.BLUETOOTH_PRIVILEGED or have a Companion Device Manager association with this device (see android.companion.CompanionDeviceManager.associate(AssociationRequest,android.companion.CompanionDeviceManager.Callback,Handler)). For apps targeting Build.VERSION_CODES.S or or higher, this requires the Manifest.permission.BLUETOOTH_CONNECT permission which can be gained with android.app.Activity.requestPermissions(String[],int).

Android reference for android.bluetooth.BluetoothDevice.disconnectAcl.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to