语言

BluetoothHeadset.GetConnectionState(BluetoothDevice) 方法

定义

获取面向Build.VERSION_CODES的应用的配置文件的当前连接状态。S 或更高版本,这需要Manifest.permission.BLUETOOTH_CONNECT权限,android.app.Activity.requestPermissions(String[],int) 获得的权限。

[Android.Runtime.Register("getConnectionState", "(Landroid/bluetooth/BluetoothDevice;)I", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.ProfileState GetConnectionState(Android.Bluetooth.BluetoothDevice? device);
[<Android.Runtime.Register("getConnectionState", "(Landroid/bluetooth/BluetoothDevice;)I", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
abstract member GetConnectionState : Android.Bluetooth.BluetoothDevice -> Android.Bluetooth.ProfileState
override this.GetConnectionState : Android.Bluetooth.BluetoothDevice -> Android.Bluetooth.ProfileState

参数

device
BluetoothDevice

远程蓝牙设备。

返回

配置文件连接的状态。 STATE_CONNECTED、STATE_CONNECTING、STATE_DISCONNECTED、STATE_DISCONNECTING值之一如下: Disconnected; ; Connecting; ConnectedDisconnecting

实现

特性

注解

获取面向Build.VERSION_CODES的应用的配置文件的当前连接状态。S 或更高版本,这需要Manifest.permission.BLUETOOTH_CONNECT权限,android.app.Activity.requestPermissions(String[],int) 获得的权限。 需要Manifest.permission.BLUETOOTH_CONNECT

Java文档android.bluetooth.BluetoothHeadset.getConnectionState(android.bluetooth.BluetoothDevice)。

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

适用于