Share via


BluetoothDevice.CreateInsecureL2capChannel(Int32) Method

Definition

Create a Bluetooth L2CAP Connection-oriented Channel (CoC) BluetoothSocket that can be used to start a secure outgoing connection to the remote device with the same dynamic protocol/service multiplexer (PSM) value.

[Android.Runtime.Register("createInsecureL2capChannel", "(I)Landroid/bluetooth/BluetoothSocket;", "", ApiSince=29)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothSocket CreateInsecureL2capChannel (int psm);
[<Android.Runtime.Register("createInsecureL2capChannel", "(I)Landroid/bluetooth/BluetoothSocket;", "", ApiSince=29)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.CreateInsecureL2capChannel : int -> Android.Bluetooth.BluetoothSocket

Parameters

psm
Int32

dynamic PSM value from remote device

Returns

a CoC #BluetoothSocket ready for an outgoing connection

Attributes

Remarks

Create a Bluetooth L2CAP Connection-oriented Channel (CoC) BluetoothSocket that can be used to start a secure outgoing connection to the remote device with the same dynamic protocol/service multiplexer (PSM) value. The supported Bluetooth transport is LE only.

This is designed to be used with BluetoothAdapter#listenUsingInsecureL2capChannel() for peer-peer Bluetooth applications.

Use BluetoothSocket#connect to initiate the outgoing connection.

Application using this API is responsible for obtaining PSM value from remote device.

The communication channel may not have an authenticated link key, i.e. it may be subject to person-in-the-middle attacks. Use #createL2capChannel(int) if an encrypted and authenticated communication channel is possible.

Java documentation for android.bluetooth.BluetoothDevice.createInsecureL2capChannel(int).

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