語言

BluetoothDevice.DisconnectAcl(BluetoothTransports) 方法

定義

會斷開此裝置的 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

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於