lightbulb_outline Please take our October 2018 developer survey. Start survey

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

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

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. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

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.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.