Register now for Android Dev Summit 2019!

NotificationCompat.BubbleMetadata

public static final class NotificationCompat.BubbleMetadata
extends Object

java.lang.Object
   ↳ 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, NotificationCompat.BubbleMetadata.Builder.setIcon(IconCompat) and an expanded state which is populated via NotificationCompat.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 NotificationCompat.BubbleMetadata.Builder

Builder to construct a NotificationCompat.BubbleMetadata object. 

Public methods

static NotificationCompat.BubbleMetadata fromPlatform(Notification.BubbleMetadata platformMetadata)

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

boolean getAutoExpandBubble()
PendingIntent getDeleteIntent()
int getDesiredHeight()
int getDesiredHeightResId()
IconCompat getIcon()
PendingIntent getIntent()
boolean isNotificationSuppressed()
static Notification.BubbleMetadata toPlatform(NotificationCompat.BubbleMetadata compatMetadata)

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

Inherited methods

Public methods

fromPlatform

public static NotificationCompat.BubbleMetadata fromPlatform (Notification.BubbleMetadata platformMetadata)

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

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, 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

public int getDesiredHeightResId ()

Returns
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

public IconCompat getIcon ()

Returns
IconCompat 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.

isNotificationSuppressed

public boolean isNotificationSuppressed ()

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

toPlatform

public static Notification.BubbleMetadata toPlatform (NotificationCompat.BubbleMetadata compatMetadata)

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.