Share via


BluetoothDevice.CreateUsingSocketSettings(BluetoothSocketSettings) Method

Definition

Creates a client socket to connect to a remote Bluetooth server with the specified socket settings BluetoothSocketSettings This API is used to connect to a remote server hosted using BluetoothAdapter#listenUsingSocketSettings.

[Android.Runtime.Register("createUsingSocketSettings", "(Landroid/bluetooth/BluetoothSocketSettings;)Landroid/bluetooth/BluetoothSocket;", "", ApiSince=36)]
public Android.Bluetooth.BluetoothSocket CreateUsingSocketSettings(Android.Bluetooth.BluetoothSocketSettings settings);
[<Android.Runtime.Register("createUsingSocketSettings", "(Landroid/bluetooth/BluetoothSocketSettings;)Landroid/bluetooth/BluetoothSocket;", "", ApiSince=36)>]
member this.CreateUsingSocketSettings : Android.Bluetooth.BluetoothSocketSettings -> Android.Bluetooth.BluetoothSocket

Parameters

settings
BluetoothSocketSettings

Bluetooth socket settings BluetoothSocketSettings.

Returns

a BluetoothSocket ready for an outgoing connection.

Attributes

Remarks

Creates a client socket to connect to a remote Bluetooth server with the specified socket settings BluetoothSocketSettings This API is used to connect to a remote server hosted using BluetoothAdapter#listenUsingSocketSettings.

<ul> <li>For `BluetoothSocket.TYPE_RFCOMM`: The RFCOMM UUID must be provided using BluetoothSocketSettings#setRfcommUuid(). <li>For `BluetoothSocket.TYPE_LE`: The L2cap protocol/service multiplexer (PSM) value must be provided using BluetoothSocketSettings#setL2capPsm(). </ul>

Application using this API is responsible for obtaining protocol/service multiplexer (psm) value from remote device.

Use BluetoothSocket#connect to initiate the outgoing connection.

Java documentation for android.bluetooth.BluetoothDevice.createUsingSocketSettings(android.bluetooth.BluetoothSocketSettings).

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