语言

BluetoothDevice.CreateInsecureRfcommSocketToServiceRecord(UUID) 方法

定义

创建一个 RFCOMM BluetoothSocket 套接字,以便使用 Uuid 的 SDP 查找启动到此远程设备的不安全传出连接。

[Android.Runtime.Register("createInsecureRfcommSocketToServiceRecord", "(Ljava/util/UUID;)Landroid/bluetooth/BluetoothSocket;", "")]
public Android.Bluetooth.BluetoothSocket? CreateInsecureRfcommSocketToServiceRecord(Java.Util.UUID? uuid);
[<Android.Runtime.Register("createInsecureRfcommSocketToServiceRecord", "(Ljava/util/UUID;)Landroid/bluetooth/BluetoothSocket;", "")>]
member this.CreateInsecureRfcommSocketToServiceRecord : Java.Util.UUID -> Android.Bluetooth.BluetoothSocket

参数

uuid
UUID

用于查找 RFCOMM 通道的服务记录 uuid

返回

用于传出连接的 RFCOMM BluetoothServerSocket

特性

例外

出错时,例如蓝牙不可用或权限不足

注解

创建一个 RFCOMM BluetoothSocket 套接字,以便使用 Uuid 的 SDP 查找启动到此远程设备的不安全传出连接。

通信通道将没有经过身份验证的链接密钥,即它将受到中间人攻击。 对于蓝牙 2.1 设备,链接密钥将加密,因为加密是必需的。 对于旧设备(蓝牙 2.1 设备前),不会加密链接密钥。 如果需要加密和经过身份验证的信道,请使用 #createRfcommSocketToServiceRecord 。

这设计用于 BluetoothAdapter#listenUsingInsecureRfcommWithServiceRecord 对等蓝牙应用程序。

用于 BluetoothSocket#connect 启动传出连接。 这还将执行给定 uuid 的 SDP 查找,以确定要连接到的通道。

远程设备将进行身份验证,并将对此套接字上的通信进行加密。

提示:如果要连接到蓝牙串行板,请尝试使用已知的 SPP UUID 00001101-0000-1000-8000-00805F9B34FB。 但是,如果要连接到 Android 对等方,请生成自己的唯一 UUID。

Java文档android.bluetooth.BluetoothDevice.createInsecureRfcommSocketToServiceRecord(java.util.UUID)。

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

适用于