Android APIs
public final class

AdvertisementData

extends Object
implements Parcelable
java.lang.Object
   ↳ android.bluetooth.le.AdvertisementData

Class Overview

Advertisement data packet for Bluetooth LE advertising. This represents the data to be broadcasted in Bluetooth LE advertising as well as the scan response for active scan.

Use AdvertisementData.Builder to create an instance of AdvertisementData to be advertised.

Summary

Nested Classes
class AdvertisementData.Builder Builder for AdvertisementData
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<AdvertisementData> CREATOR
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
boolean getIncludeTxPowerLevel()
Whether the transmission power level will be included in the advertisement packet.
int getManufacturerId()
Returns the manufacturer identifier, which is a non-negative number assigned by Bluetooth SIG.
byte[] getManufacturerSpecificData()
Returns the manufacturer specific data which is the content of manufacturer specific data field.
byte[] getServiceData()
Returns service data.
ParcelUuid getServiceDataUuid()
Returns a 16 bit uuid of the service that the service data is associated with.
List<ParcelUuid> getServiceUuids()
Returns a list of service uuids within the advertisement that are used to identify the bluetooth GATT services.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<AdvertisementData> CREATOR

Public Methods

public int describeContents ()

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

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public boolean getIncludeTxPowerLevel ()

Whether the transmission power level will be included in the advertisement packet.

public int getManufacturerId ()

Returns the manufacturer identifier, which is a non-negative number assigned by Bluetooth SIG.

public byte[] getManufacturerSpecificData ()

Returns the manufacturer specific data which is the content of manufacturer specific data field. The first 2 bytes of the data contain the company id.

public byte[] getServiceData ()

Returns service data. The first two bytes should be a 16 bit service uuid associated with the service data.

public ParcelUuid getServiceDataUuid ()

Returns a 16 bit uuid of the service that the service data is associated with.

public List<ParcelUuid> getServiceUuids ()

Returns a list of service uuids within the advertisement that are used to identify the bluetooth GATT services.

public String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

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

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel dest, int flags)

Flatten this object in to a Parcel.

Parameters
dest The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.