NotificationCompat.BubbleMetadata

Added in 1.2.0

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 functions

fromPlatform

Added in 1.2.0
java-static fun fromPlatform(platformMetadata: Notification.BubbleMetadata?): NotificationCompat.BubbleMetadata?

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

Parameters
platformMetadata: Notification.BubbleMetadata?

the Notification.BubbleMetadata to convert

Returns
NotificationCompat.BubbleMetadata?

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

getAutoExpandBubble

Added in 1.2.0
fun getAutoExpandBubble(): Boolean
Returns
Boolean

whether this bubble should auto expand when it is posted.

getDeleteIntent

Added in 1.2.0
fun getDeleteIntent(): PendingIntent?
Returns
PendingIntent?

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

getDesiredHeight

Added in 1.2.0
fun getDesiredHeight(): @Dimension(unit = 0) Int
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
fun getDesiredHeightResId(): @DimenRes Int
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
fun getIcon(): IconCompat?
Returns
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
fun getIntent(): PendingIntent?
Returns
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
fun getShortcutId(): String?
Returns
String?

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

isNotificationSuppressed

Added in 1.2.0
fun isNotificationSuppressed(): Boolean
Returns
Boolean

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

toPlatform

Added in 1.2.0
java-static fun toPlatform(compatMetadata: NotificationCompat.BubbleMetadata?): Notification.BubbleMetadata?

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

Parameters
compatMetadata: NotificationCompat.BubbleMetadata?

the NotificationCompat.BubbleMetadata to convert

Returns
Notification.BubbleMetadata?

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