语言

BluetoothHidDevice.Connect(BluetoothDevice) 方法

定义

启动与当前与此设备配对的主机的连接。

[Android.Runtime.Register("connect", "(Landroid/bluetooth/BluetoothDevice;)Z", "", ApiSince=28)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool Connect(Android.Bluetooth.BluetoothDevice? device);
[<Android.Runtime.Register("connect", "(Landroid/bluetooth/BluetoothDevice;)Z", "", ApiSince=28)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.Connect : Android.Bluetooth.BluetoothDevice -> bool

参数

返回

如果成功发送命令,则为 true;否则为 false。

特性

注解

启动与当前与此设备配对的主机的连接。 如果未注册应用程序,#connect(BluetoothDevice)将失败。 应用程序应通过处理 Callback#onConnectionStateChanged 的回调来跟踪连接状态。 连接状态与此方法的返回值无关。

Java文档android.bluetooth.BluetoothHidDevice.connect(android.bluetooth.BluetoothDevice)。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于