Android APIs
public final class

AdvertiseData

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

Class Overview

Advertise data packet container for Bluetooth LE advertising. This represents the data to be advertised as well as the scan response data for active scans.

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

Summary

Nested Classes
class AdvertiseData.Builder Builder for AdvertiseData
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<AdvertiseData> CREATOR
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
boolean getIncludeDeviceName()
Whether the device name will be included in the advertisement packet.
boolean getIncludeTxPowerLevel()
Whether the transmission power level will be included in the advertisement packet.
SparseArray<byte[]> getManufacturerSpecificData()
Returns an array of manufacturer Id and the corresponding manufacturer specific data.
Map<ParcelUuid, byte[]> getServiceData()
Returns a map of 16-bit UUID and its corresponding service data.
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<AdvertiseData> CREATOR

Added in API level 21

Public Methods

public int describeContents ()

Added in API level 21

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

Added in API level 21

Whether the device name will be included in the advertisement packet.

public boolean getIncludeTxPowerLevel ()

Added in API level 21

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

public SparseArray<byte[]> getManufacturerSpecificData ()

Added in API level 21

Returns an array of manufacturer Id and the corresponding manufacturer specific data. The manufacturer id is a non-negative number assigned by Bluetooth SIG.

public Map<ParcelUuid, byte[]> getServiceData ()

Added in API level 21

Returns a map of 16-bit UUID and its corresponding service data.

public List<ParcelUuid> getServiceUuids ()

Added in API level 21

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

public String toString ()

Added in API level 21

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)

Added in API level 21

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.