AdvertisingSetParameters

public final class AdvertisingSetParameters
extends Object implements Parcelable

java.lang.Object
   ↳ android.bluetooth.le.AdvertisingSetParameters


The AdvertisingSetParameters provide a way to adjust advertising preferences for each Bluetooth LE advertising set. Use AdvertisingSetParameters.Builder to create an instance of this class.

Summary

Nested classes

class AdvertisingSetParameters.Builder

Builder class for AdvertisingSetParameters

Constants

int INTERVAL_HIGH

Advertise on low frequency, around every 1000ms.

int INTERVAL_LOW

Perform high frequency, low latency advertising, around every 100ms.

int INTERVAL_MAX

Maximum value for advertising interval.

int INTERVAL_MEDIUM

Advertise on medium frequency, around every 250ms.

int INTERVAL_MIN

Minimum value for advertising interval.

int TX_POWER_HIGH

Advertise using high TX power level.

int TX_POWER_LOW

Advertise using low TX power level.

int TX_POWER_MAX

Maximum value for TX power.

int TX_POWER_MEDIUM

Advertise using medium TX power level.

int TX_POWER_MIN

Minimum value for TX power.

int TX_POWER_ULTRA_LOW

Advertise using the lowest transmission (TX) power level.

Inherited constants

Fields

public static final Creator<AdvertisingSetParameters> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

int getInterval()

Returns the advertising interval.

int getPrimaryPhy()

Returns the primary advertising phy.

int getSecondaryPhy()

Returns the secondary advertising phy.

int getTxPowerLevel()

Returns the TX power level for advertising.

boolean includeTxPower()

Returns whether the TX Power will be included.

boolean isAnonymous()

Returns whether the advertisement will be anonymous.

boolean isConnectable()

Returns whether the advertisement will be connectable.

boolean isDiscoverable()

Returns whether the advertisement will be discoverable.

boolean isLegacy()

Returns whether the legacy advertisement will be used.

boolean isScannable()

Returns whether the advertisement will be scannable.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

INTERVAL_HIGH

Added in API level 26
public static final int INTERVAL_HIGH

Advertise on low frequency, around every 1000ms. This is the default and preferred advertising mode as it consumes the least power.

Constant Value: 1600 (0x00000640)

INTERVAL_LOW

Added in API level 26
public static final int INTERVAL_LOW

Perform high frequency, low latency advertising, around every 100ms. This has the highest power consumption and should not be used for continuous background advertising.

Constant Value: 160 (0x000000a0)

INTERVAL_MAX

Added in API level 26
public static final int INTERVAL_MAX

Maximum value for advertising interval.

Constant Value: 16777215 (0x00ffffff)

INTERVAL_MEDIUM

Added in API level 26
public static final int INTERVAL_MEDIUM

Advertise on medium frequency, around every 250ms. This is balanced between advertising frequency and power consumption.

Constant Value: 400 (0x00000190)

INTERVAL_MIN

Added in API level 26
public static final int INTERVAL_MIN

Minimum value for advertising interval.

Constant Value: 160 (0x000000a0)

TX_POWER_HIGH

Added in API level 26
public static final int TX_POWER_HIGH

Advertise using high TX power level. This corresponds to largest visibility range of the advertising packet.

Constant Value: 1 (0x00000001)

TX_POWER_LOW

Added in API level 26
public static final int TX_POWER_LOW

Advertise using low TX power level.

Constant Value: -15 (0xfffffff1)

TX_POWER_MAX

Added in API level 26
public static final int TX_POWER_MAX

Maximum value for TX power.

Constant Value: 1 (0x00000001)

TX_POWER_MEDIUM

Added in API level 26
public static final int TX_POWER_MEDIUM

Advertise using medium TX power level.

Constant Value: -7 (0xfffffff9)

TX_POWER_MIN

Added in API level 26
public static final int TX_POWER_MIN

Minimum value for TX power.

Constant Value: -127 (0xffffff81)

TX_POWER_ULTRA_LOW

Added in API level 26
public static final int TX_POWER_ULTRA_LOW

Advertise using the lowest transmission (TX) power level. Low transmission power can be used to restrict the visibility range of advertising packets.

Constant Value: -21 (0xffffffeb)

Fields

CREATOR

Added in API level 26
public static final Creator<AdvertisingSetParameters> CREATOR

Public methods

describeContents

Added in API level 26
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

getInterval

Added in API level 26
public int getInterval ()

Returns the advertising interval.

Returns
int

getPrimaryPhy

Added in API level 26
public int getPrimaryPhy ()

Returns the primary advertising phy.

Returns
int

getSecondaryPhy

Added in API level 26
public int getSecondaryPhy ()

Returns the secondary advertising phy.

Returns
int

getTxPowerLevel

Added in API level 26
public int getTxPowerLevel ()

Returns the TX power level for advertising.

Returns
int

includeTxPower

Added in API level 26
public boolean includeTxPower ()

Returns whether the TX Power will be included.

Returns
boolean

isAnonymous

Added in API level 26
public boolean isAnonymous ()

Returns whether the advertisement will be anonymous.

Returns
boolean

isConnectable

Added in API level 26
public boolean isConnectable ()

Returns whether the advertisement will be connectable.

Returns
boolean

isDiscoverable

Added in API level 34
public boolean isDiscoverable ()

Returns whether the advertisement will be discoverable.

Returns
boolean

isLegacy

Added in API level 26
public boolean isLegacy ()

Returns whether the legacy advertisement will be used.

Returns
boolean

isScannable

Added in API level 26
public boolean isScannable ()

Returns whether the advertisement will be scannable.

Returns
boolean

toString

Added in API level 26
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

writeToParcel

Added in API level 26
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES