NotificationCompat.BubbleMetadata

Added in 1.2.0

public final class NotificationCompat.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, setIcon and an expanded state which is populated via setIntent.

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 types

Builder to construct a BubbleMetadata object.

Public methods

fromPlatform

Added in 1.2.0
public static @Nullable NotificationCompat.BubbleMetadata fromPlatform(@Nullable Notification.BubbleMetadata platformMetadata)

Converts a platform-level Notification.BubbleMetadata to a NotificationCompat.BubbleMetadata.

Parameters
@Nullable Notification.BubbleMetadata platformMetadata

the Notification.BubbleMetadata to convert

Returns
@Nullable NotificationCompat.BubbleMetadata

a NotificationCompat.BubbleMetadata containing the same data if platformMetadata is non-null, otherwise null.

getAutoExpandBubble

Added in 1.2.0
public boolean getAutoExpandBubble()
Returns
boolean

whether this bubble should auto expand when it is posted.

getDeleteIntent

Added in 1.2.0
public @Nullable PendingIntent getDeleteIntent()
Returns
@Nullable PendingIntent

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

getDesiredHeight

Added in 1.2.0
public @Dimension(unit = 0) int getDesiredHeight()
Returns
@Dimension(unit = 0) 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 1.2.0
public @DimenRes int getDesiredHeightResId()
Returns
@DimenRes 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 1.2.0
public @Nullable IconCompat getIcon()
Returns
@Nullable IconCompat

the icon that will be displayed for this bubble when it is collapsed, or null if the bubble is created via Builder.

getIntent

Added in 1.2.0
public @Nullable PendingIntent getIntent()
Returns
@Nullable PendingIntent

the pending intent used to populate the floating window for this bubble, or null if this bubble is created via Builder.

getShortcutId

Added in 1.5.0
public @Nullable String getShortcutId()
Returns
@Nullable String

the shortcut id used for this bubble if created via Builder or null if created via Builder.

isNotificationSuppressed

Added in 1.2.0
public boolean isNotificationSuppressed()
Returns
boolean

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

toPlatform

Added in 1.2.0
public static @Nullable Notification.BubbleMetadata toPlatform(@Nullable NotificationCompat.BubbleMetadata compatMetadata)

Converts a NotificationCompat.BubbleMetadata to a platform-level Notification.BubbleMetadata.

Parameters
@Nullable NotificationCompat.BubbleMetadata compatMetadata

the NotificationCompat.BubbleMetadata to convert

Returns
@Nullable Notification.BubbleMetadata

a Notification.BubbleMetadata containing the same data if compatMetadata is non-null, otherwise null.