Stay organized with collections
Save and categorize content based on your preferences.
BluetoothSocketSettings
class BluetoothSocketSettings
Defines parameters for creating Bluetooth server and client socket channels.
Used with BluetoothAdapter.listenUsingSocketSettings
to create a server socket and BluetoothDevice.createUsingSocketSettings
to create a client socket.
Summary
Public methods |
Int |
Returns the L2CAP PSM value used for a BluetoothSocket#TYPE_LE socket.
|
String? |
Returns the RFCOMM service name used for a BluetoothSocket#TYPE_RFCOMM socket.
|
UUID? |
Returns the RFCOMM service UUID used for a BluetoothSocket#TYPE_RFCOMM socket.
|
Int |
Returns the type of the Bluetooth socket.
|
Boolean |
Checks if authentication is enabled for the Bluetooth socket.
|
Boolean |
Checks if encryption is enabled for the Bluetooth socket.
|
String |
Returns a String that describes each BluetoothSocketSettings parameter current value.
|
Public methods
getL2capPsm
fun getL2capPsm(): Int
Returns the L2CAP PSM value used for a BluetoothSocket#TYPE_LE socket.
Return |
Int |
Value is between 128 and 255 inclusive |
getRfcommServiceName
fun getRfcommServiceName(): String?
Returns the RFCOMM service name used for a BluetoothSocket#TYPE_RFCOMM socket.
Defaults to null
.
getRfcommUuid
fun getRfcommUuid(): UUID?
Returns the RFCOMM service UUID used for a BluetoothSocket#TYPE_RFCOMM socket.
Defaults to null
.
getSocketType
fun getSocketType(): Int
Returns the type of the Bluetooth socket.
Defaults to BluetoothSocket#TYPE_RFCOMM
.
isAuthenticationRequired
fun isAuthenticationRequired(): Boolean
Checks if authentication is enabled for the Bluetooth socket.
Defaults to false
.
isEncryptionRequired
fun isEncryptionRequired(): Boolean
Checks if encryption is enabled for the Bluetooth socket.
Defaults to false
.
toString
fun toString(): String
Returns a String
that describes each BluetoothSocketSettings parameter current value.
Return |
String |
a string representation of the object. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-03-13 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-13 UTC."],[],[],null,["# BluetoothSocketSettings\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBluetoothSocketSettings\n=======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/bluetooth/BluetoothSocketSettings \"View this page in Java\") \n\n```\nclass BluetoothSocketSettings\n```\n\n|---|------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.bluetooth.BluetoothSocketSettings](#) |\n\nDefines parameters for creating Bluetooth server and client socket channels.\n\nUsed with [BluetoothAdapter.listenUsingSocketSettings](/reference/kotlin/android/bluetooth/BluetoothAdapter#listenUsingSocketSettings(android.bluetooth.BluetoothSocketSettings)) to create a server socket and [BluetoothDevice.createUsingSocketSettings](/reference/kotlin/android/bluetooth/BluetoothDevice#createUsingSocketSettings(android.bluetooth.BluetoothSocketSettings)) to create a client socket.\n\nSummary\n-------\n\n| Nested classes ||\n|---|--------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/reference/kotlin/android/bluetooth/BluetoothSocketSettings.Builder) Builder for [BluetoothSocketSettings](#). |\n\n| Public methods ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getL2capPsm](#getL2capPsm())`()` Returns the L2CAP PSM value used for a BluetoothSocket#TYPE_LE socket. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | [getRfcommServiceName](#getRfcommServiceName())`()` Returns the RFCOMM service name used for a BluetoothSocket#TYPE_RFCOMM socket. |\n| [UUID](../../java/util/UUID.html#)? | [getRfcommUuid](#getRfcommUuid())`()` Returns the RFCOMM service UUID used for a BluetoothSocket#TYPE_RFCOMM socket. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getSocketType](#getSocketType())`()` Returns the type of the Bluetooth socket. |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isAuthenticationRequired](#isAuthenticationRequired())`()` Checks if authentication is enabled for the Bluetooth socket. |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isEncryptionRequired](#isEncryptionRequired())`()` Checks if encryption is enabled for the Bluetooth socket. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](#toString())`()` Returns a [String](../../java/lang/String.html#) that describes each BluetoothSocketSettings parameter current value. |\n\nPublic methods\n--------------\n\n### getL2capPsm\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getL2capPsm(): Int\n```\n\nReturns the L2CAP PSM value used for a BluetoothSocket#TYPE_LE socket.\n\n| Return ||\n|----------------------------------------------------------------------------|----------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is between 128 and 255 inclusive |\n\n### getRfcommServiceName\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getRfcommServiceName(): String?\n```\n\nReturns the RFCOMM service name used for a BluetoothSocket#TYPE_RFCOMM socket.\n\nDefaults to `null`. \n\n### getRfcommUuid\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getRfcommUuid(): UUID?\n```\n\nReturns the RFCOMM service UUID used for a BluetoothSocket#TYPE_RFCOMM socket.\n\nDefaults to `null`. \n\n### getSocketType\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getSocketType(): Int\n```\n\nReturns the type of the Bluetooth socket.\n\nDefaults to `BluetoothSocket#TYPE_RFCOMM`.\n\n| Return ||\n|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is [android.bluetooth.BluetoothSocket#TYPE_RFCOMM](/reference/kotlin/android/bluetooth/BluetoothSocket#TYPE_RFCOMM:kotlin.Int), [android.bluetooth.BluetoothSocket#TYPE_SCO](/reference/kotlin/android/bluetooth/BluetoothSocket#TYPE_SCO:kotlin.Int), [android.bluetooth.BluetoothSocket#TYPE_L2CAP](/reference/kotlin/android/bluetooth/BluetoothSocket#TYPE_L2CAP:kotlin.Int), or [android.bluetooth.BluetoothSocket#TYPE_LE](/reference/kotlin/android/bluetooth/BluetoothSocket#TYPE_LE:kotlin.Int) |\n\n### isAuthenticationRequired\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun isAuthenticationRequired(): Boolean\n```\n\nChecks if authentication is enabled for the Bluetooth socket.\n\nDefaults to `false`. \n\n### isEncryptionRequired\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun isEncryptionRequired(): Boolean\n```\n\nChecks if encryption is enabled for the Bluetooth socket.\n\nDefaults to `false`. \n\n### toString\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun toString(): String\n```\n\nReturns a [String](../../java/lang/String.html#) that describes each BluetoothSocketSettings parameter current value.\n\n| Return ||\n|----------------------------------------------------------------------------------|----------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |"]]