Android APIs
public static final class

AdvertiseSettings.Builder

extends Object
java.lang.Object
   ↳ android.bluetooth.le.AdvertiseSettings.Builder

Class Overview

Builder class for AdvertiseSettings.

Summary

Public Constructors
AdvertiseSettings.Builder()
Public Methods
AdvertiseSettings build()
Build the AdvertiseSettings object.
AdvertiseSettings.Builder setAdvertiseMode(int advertiseMode)
Set advertise mode to control the advertising power and latency.
AdvertiseSettings.Builder setConnectable(boolean connectable)
Set whether the advertisement type should be connectable or non-connectable.
AdvertiseSettings.Builder setTimeout(int timeoutMillis)
Limit advertising to a given amount of time.
AdvertiseSettings.Builder setTxPowerLevel(int txPowerLevel)
Set advertise TX power level to control the transmission power level for the advertising.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AdvertiseSettings.Builder ()

Added in API level 21

Public Methods

public AdvertiseSettings build ()

Added in API level 21

Build the AdvertiseSettings object.

public AdvertiseSettings.Builder setAdvertiseMode (int advertiseMode)

Added in API level 21

Set advertise mode to control the advertising power and latency.

Parameters
advertiseMode Bluetooth LE Advertising mode, can only be one of ADVERTISE_MODE_LOW_POWER, ADVERTISE_MODE_BALANCED, or ADVERTISE_MODE_LOW_LATENCY.
Throws
IllegalArgumentException If the advertiseMode is invalid.

public AdvertiseSettings.Builder setConnectable (boolean connectable)

Added in API level 21

Set whether the advertisement type should be connectable or non-connectable.

Parameters
connectable Controls whether the advertisment type will be connectable (true) or non-connectable (false).

public AdvertiseSettings.Builder setTimeout (int timeoutMillis)

Added in API level 21

Limit advertising to a given amount of time.

Parameters
timeoutMillis Advertising time limit. May not exceed 180000 milliseconds. A value of 0 will disable the time limit.
Throws
IllegalArgumentException If the provided timeout is over 180000 ms.

public AdvertiseSettings.Builder setTxPowerLevel (int txPowerLevel)

Added in API level 21

Set advertise TX power level to control the transmission power level for the advertising.

Parameters
txPowerLevel Transmission power of Bluetooth LE Advertising, can only be one of ADVERTISE_TX_POWER_ULTRA_LOW, ADVERTISE_TX_POWER_LOW, ADVERTISE_TX_POWER_MEDIUM or ADVERTISE_TX_POWER_HIGH.
Throws
IllegalArgumentException If the txPowerLevel is invalid.