Builder
class Builder
kotlin.Any | |
↳ | android.bluetooth.le.AdvertiseSettings.Builder |
Builder class for AdvertiseSettings
.
Requires API level 21 (Android 5.0, Lollipop)
Summary
Public constructors | |
---|---|
<init>() |
Public methods | |
---|---|
AdvertiseSettings.Builder! |
setAdvertiseMode(advertiseMode: Int) Set advertise mode to control the advertising power and latency. |
AdvertiseSettings.Builder! |
setTxPowerLevel(txPowerLevel: Int) Set advertise TX power level to control the transmission power level for the advertising. |
AdvertiseSettings.Builder! |
setConnectable(connectable: Boolean) Set whether the advertisement type should be connectable or non-connectable. |
AdvertiseSettings.Builder! |
setTimeout(timeoutMillis: Int) Limit advertising to a given amount of time. |
AdvertiseSettings! |
build() Build the |
Public constructors
<init>
Builder()
Public methods
setAdvertiseMode
fun setAdvertiseMode(advertiseMode: Int): AdvertiseSettings.Builder!
Set advertise mode to control the advertising power and latency.
Requires API level 21 (Android 5.0, Lollipop)
Parameters | |
---|---|
advertiseMode |
Int: Bluetooth LE Advertising mode, can only be one of , AdvertiseSettings#ADVERTISE_MODE_BALANCED , or AdvertiseSettings#ADVERTISE_MODE_LOW_LATENCY . |
Exceptions | |
---|---|
IllegalArgumentException |
If the advertiseMode is invalid. |
setTxPowerLevel
fun setTxPowerLevel(txPowerLevel: Int): AdvertiseSettings.Builder!
Set advertise TX power level to control the transmission power level for the advertising.
Requires API level 21 (Android 5.0, Lollipop)
Parameters | |
---|---|
txPowerLevel |
Int: Transmission power of Bluetooth LE Advertising, can only be one of AdvertiseSettings#ADVERTISE_TX_POWER_ULTRA_LOW , , AdvertiseSettings#ADVERTISE_TX_POWER_MEDIUM or AdvertiseSettings#ADVERTISE_TX_POWER_HIGH . |
Exceptions | |
---|---|
IllegalArgumentException |
If the txPowerLevel is invalid. |
setConnectable
fun setConnectable(connectable: Boolean): AdvertiseSettings.Builder!
Set whether the advertisement type should be connectable or non-connectable.
Requires API level 21 (Android 5.0, Lollipop)
Parameters | |
---|---|
connectable |
Boolean: Controls whether the advertisment type will be connectable (true) or non-connectable (false). |
setTimeout
fun setTimeout(timeoutMillis: Int): AdvertiseSettings.Builder!
Limit advertising to a given amount of time.
Requires API level 21 (Android 5.0, Lollipop)
Parameters | |
---|---|
timeoutMillis |
Int: Advertising time limit. May not exceed 180000 milliseconds. A value of 0 will disable the time limit. |
Exceptions | |
---|---|
IllegalArgumentException |
If the provided timeout is over 180000 ms. |
build
fun build(): AdvertiseSettings!
Build the AdvertiseSettings
object.
Requires API level 21 (Android 5.0, Lollipop)