BubbleMetadata

class BubbleMetadata
kotlin.Any
   ↳ androidx.core.app.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, BubbleMetadata.Builder#setIcon(IconCompat) and an expanded state which is populated via 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

Builder to construct a BubbleMetadata object.

Public methods

static NotificationCompat.BubbleMetadata?
fromPlatform(@Nullable platformMetadata: BubbleMetadata?)

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

Boolean

PendingIntent?

Int

Int

IconCompat

PendingIntent

Boolean

static BubbleMetadata?
toPlatform(@Nullable compatMetadata: NotificationCompat.BubbleMetadata?)

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

Public methods

fromPlatform

@Nullable static fun fromPlatform(@Nullable platformMetadata: BubbleMetadata?): NotificationCompat.BubbleMetadata?

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

Parameters
platformMetadata BubbleMetadata?: the Notification.BubbleMetadata to convert
Return
NotificationCompat.BubbleMetadata?: a NotificationCompat.BubbleMetadata containing the same data if platformMetadata is non-null, otherwise null.

getAutoExpandBubble

fun getAutoExpandBubble(): Boolean
Return
Boolean: whether this bubble should auto expand when it is posted.

getDeleteIntent

@Nullable fun getDeleteIntent(): PendingIntent?
Return
PendingIntent?: the pending intent to send when the bubble is dismissed by a user, if one exists.

getDesiredHeight

@Dimension(0) 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

@DimenRes 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

@NonNull fun getIcon(): IconCompat
Return
IconCompat: the icon that will be displayed for this bubble when it is collapsed.

getIntent

@NonNull fun getIntent(): PendingIntent
Return
PendingIntent: the pending intent used to populate the floating window for this bubble.

isNotificationSuppressed

fun isNotificationSuppressed(): Boolean
Return
Boolean: whether this bubble should suppress the notification when it is posted.

toPlatform

@Nullable static fun toPlatform(@Nullable compatMetadata: NotificationCompat.BubbleMetadata?): BubbleMetadata?

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

Parameters
compatMetadata NotificationCompat.BubbleMetadata?: the NotificationCompat.BubbleMetadata to convert
Return
BubbleMetadata?: a Notification.BubbleMetadata containing the same data if compatMetadata is non-null, otherwise null.