Skip to content

Most visited

Recently visited

navigation

AdvertiseSettings.Builder

public static final class AdvertiseSettings.Builder
extends Object

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


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.

Inherited methods

From class java.lang.Object

Public constructors

AdvertiseSettings.Builder

added in API level 21
AdvertiseSettings.Builder ()

Public methods

build

added in API level 21
AdvertiseSettings build ()

Build the AdvertiseSettings object.

Returns
AdvertiseSettings

setAdvertiseMode

added in API level 21
AdvertiseSettings.Builder setAdvertiseMode (int advertiseMode)

Set advertise mode to control the advertising power and latency.

Parameters
advertiseMode int: Bluetooth LE Advertising mode, can only be one of ADVERTISE_MODE_LOW_POWER, ADVERTISE_MODE_BALANCED, or ADVERTISE_MODE_LOW_LATENCY.

Returns
AdvertiseSettings.Builder

Throws
IllegalArgumentException If the advertiseMode is invalid.

setConnectable

added in API level 21
AdvertiseSettings.Builder setConnectable (boolean connectable)

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

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

Returns
AdvertiseSettings.Builder

setTimeout

added in API level 21
AdvertiseSettings.Builder setTimeout (int timeoutMillis)

Limit advertising to a given amount of time.

Parameters
timeoutMillis int: Advertising time limit. May not exceed 180000 milliseconds. A value of 0 will disable the time limit.

Returns
AdvertiseSettings.Builder

Throws
IllegalArgumentException If the provided timeout is over 180000 ms.

setTxPowerLevel

added in API level 21
AdvertiseSettings.Builder setTxPowerLevel (int txPowerLevel)

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

Parameters
txPowerLevel int: 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.

Returns
AdvertiseSettings.Builder

Throws
IllegalArgumentException If the txPowerLevel is invalid.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)