Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

Notification.BubbleMetadata

public static final class Notification.BubbleMetadata
extends Object implements Parcelable

java.lang.Object
   ↳ android.app.Notification.BubbleMetadata


Encapsulates the information needed to display a notification as a bubble.

A bubble is used to display app content in a floating window over the existing foreground activity. A bubble has a collapsed state represented by an icon, Notification.BubbleMetadata.Builder.setIcon(Icon) and an expanded state which is populated via Notification.BubbleMetadata.Builder.setIntent(PendingIntent).

Notifications with a valid and allowed bubble will display in collapsed state outside of the notification shade on unlocked devices. When a user interacts with the collapsed bubble, the bubble intent will be invoked and displayed.

Summary

Nested classes

class Notification.BubbleMetadata.Builder

Builder to construct a BubbleMetadata object. 

Inherited constants

Fields

public static final Creator<Notification.BubbleMetadata> CREATOR

Public methods

int describeContents()

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

boolean getAutoExpandBubble()
PendingIntent getDeleteIntent()
int getDesiredHeight()
Icon getIcon()
PendingIntent getIntent()
boolean getSuppressInitialNotification()
CharSequence getTitle()

This method was deprecated in API level Q. titles are no longer required or shown.

void writeToParcel(Parcel out, int flags)

Flatten this object in to a Parcel.

Inherited methods

Fields

CREATOR

public static final Creator<Notification.BubbleMetadata> CREATOR

Public methods

describeContents

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

getAutoExpandBubble

public boolean getAutoExpandBubble ()

Returns
boolean whether this bubble should auto expand when it is posted.

getDeleteIntent

public PendingIntent getDeleteIntent ()

Returns
PendingIntent the pending intent to send when the bubble is dismissed by a user, if one exists.

getDesiredHeight

public int getDesiredHeight ()

Returns
int the ideal height for the floating window that app content defined by getIntent() for this bubble.

getIcon

public Icon getIcon ()

Returns
Icon the icon that will be displayed for this bubble when it is collapsed.

getIntent

public PendingIntent getIntent ()

Returns
PendingIntent the pending intent used to populate the floating window for this bubble.

getSuppressInitialNotification

public boolean getSuppressInitialNotification ()

Returns
boolean whether this bubble should suppress the initial notification when it is posted.

getTitle

public CharSequence getTitle ()

This method was deprecated in API level Q.
titles are no longer required or shown.

Returns
CharSequence the title that will appear along with the app content defined by getIntent() for this bubble.

writeToParcel

public void writeToParcel (Parcel out, 
                int flags)

Flatten this object in to a Parcel.

Parameters
out 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. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES