Most visited

Recently visited

Added in API level 21

AdvertiseSettings.Builder

public static final class AdvertiseSettings.Builder
extends Object

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


Builder类为 AdvertiseSettings

Summary

Public constructors

AdvertiseSettings.Builder()

Public methods

AdvertiseSettings build()

构建 AdvertiseSettings对象。

AdvertiseSettings.Builder setAdvertiseMode(int advertiseMode)

设置广告模式来控制广告功能和延迟。

AdvertiseSettings.Builder setConnectable(boolean connectable)

设置广告类型是可连接还是不可连接。

AdvertiseSettings.Builder setTimeout(int timeoutMillis)

将广告限制在一定的时间内。

AdvertiseSettings.Builder setTxPowerLevel(int txPowerLevel)

设置通告发射功率级别来控制广告的发射功率级别。

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 ()

构建 AdvertiseSettings对象。

Returns
AdvertiseSettings

setAdvertiseMode

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

设置广告模式来控制广告功能和延迟。

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)

设置广告类型是可连接还是不可连接。

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)

将广告限制在一定的时间内。

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)

设置通告发射功率级别来控制广告的发射功率级别。

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.

Hooray!