Added in API level 29

BubbleMetadata


class BubbleMetadata : Parcelable
kotlin.Any
   ↳ 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 and an expanded state that displays an activity. These may be defined via Builder.Builder(PendingIntent, Icon) or they may be defined via an existing shortcut using Builder.Builder(String).

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 activity will be invoked and displayed.

Summary

Nested classes

Builder to construct a BubbleMetadata object.

Inherited constants
Public methods
Int

Boolean

PendingIntent?

Int

Int

Icon?

PendingIntent?

String?

Boolean

Indicates whether the bubble should be visually suppressed from the bubble stack if the user is viewing the same content outside of the bubble.

Boolean

Indicates whether the bubble is currently visually suppressed from the bubble stack.

Boolean

Indicates whether the notification associated with the bubble is being visually suppressed from the notification shade.

Unit
writeToParcel(out: Parcel, flags: Int)

Properties
static Parcelable.Creator<Notification.BubbleMetadata!>

Public methods

describeContents

Added in API level 29
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getAutoExpandBubble

Added in API level 29
fun getAutoExpandBubble(): Boolean
Return
Boolean whether this bubble should auto expand when it is posted.

getDeleteIntent

Added in API level 29
fun getDeleteIntent(): PendingIntent?
Return
PendingIntent? the pending intent to send when the bubble is dismissed by a user, if one exists. This value may be null.

getDesiredHeight

Added in API level 29
fun getDesiredHeight(): Int
Return
Int the ideal height, in DPs, for the floating window that app content defined by getIntent() for this bubble. A value of 0 indicates a desired height has not been set.

getDesiredHeightResId

Added in API level 29
fun getDesiredHeightResId(): Int
Return
Int the resId of ideal height for the floating window that app content defined by getIntent() for this bubble. A value of 0 indicates a res value has not been provided for the desired height.

getIcon

Added in API level 29
fun getIcon(): Icon?
Return
Icon? the icon that will be displayed for this bubble when it is collapsed, or null if the bubble is created via Builder.Builder(String).

getIntent

Added in API level 29
fun getIntent(): PendingIntent?
Return
PendingIntent? the pending intent used to populate the floating window for this bubble, or null if this bubble is created via Builder.Builder(String).

getShortcutId

Added in API level 30
fun getShortcutId(): String?
Return
String? the shortcut id used for this bubble if created via Builder.Builder(String) or null if created via Builder.Builder(PendingIntent, Icon).

isBubbleSuppressable

Added in API level 31
fun isBubbleSuppressable(): Boolean

Indicates whether the bubble should be visually suppressed from the bubble stack if the user is viewing the same content outside of the bubble. For example, the user has a bubble with Alice and then opens up the main app and navigates to Alice's page. To match the activity and the bubble notification, the bubble notification should have a locus id set that matches a locus id set on the activity.

Return
Boolean whether this bubble should be suppressed when the same content is visible outside of the bubble.

isBubbleSuppressed

Added in API level 31
fun isBubbleSuppressed(): Boolean

Indicates whether the bubble is currently visually suppressed from the bubble stack.

isNotificationSuppressed

Added in API level 29
fun isNotificationSuppressed(): Boolean

Indicates whether the notification associated with the bubble is being visually suppressed from the notification shade. When true the notification is hidden, when false the notification shows as normal.

Apps sending bubbles may set this flag so that the bubble is posted without the associated notification in the notification shade.

Generally the app should only set this flag if the user has performed an action to request or create a bubble, or if the user has seen the content in the notification and the notification is no longer relevant.

The system will update this flag with true to hide the notification from the user once the bubble has been expanded.

Return
Boolean whether this bubble should suppress the notification when it is posted.

writeToParcel

Added in API level 29
fun writeToParcel(
    out: Parcel,
    flags: Int
): Unit
Parameters
dest 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_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 29
static val CREATOR: Parcelable.Creator<Notification.BubbleMetadata!>