public final class

NotificationCompat.BubbleMetadata

extends java.lang.Object

 java.lang.Object

↳androidx.core.app.NotificationCompat.BubbleMetadata

Overview

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

Methods
public static NotificationCompat.BubbleMetadatafromPlatform(android.app.Notification.BubbleMetadata platformMetadata)

Converts a platform-level to a NotificationCompat.BubbleMetadata.

public booleangetAutoExpandBubble()

public PendingIntentgetDeleteIntent()

public intgetDesiredHeight()

public intgetDesiredHeightResId()

public IconCompatgetIcon()

public PendingIntentgetIntent()

public java.lang.StringgetShortcutId()

public booleanisNotificationSuppressed()

public voidsetFlags(int flags)

public static android.app.Notification.BubbleMetadatatoPlatform(NotificationCompat.BubbleMetadata compatMetadata)

Converts a NotificationCompat.BubbleMetadata to a platform-level .

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public PendingIntent getIntent()

Returns:

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

public java.lang.String getShortcutId()

Returns:

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

public PendingIntent getDeleteIntent()

Returns:

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

public IconCompat getIcon()

Returns:

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

public int getDesiredHeight()

Returns:

the ideal height, in DPs, for the floating window that app content defined by NotificationCompat.BubbleMetadata.getIntent() for this bubble. A value of 0 indicates a desired height has not been set.

public int getDesiredHeightResId()

Returns:

the resId of ideal height for the floating window that app content defined by NotificationCompat.BubbleMetadata.getIntent() for this bubble. A value of 0 indicates a res value has not been provided for the desired height.

public boolean getAutoExpandBubble()

Returns:

whether this bubble should auto expand when it is posted.

See also: NotificationCompat.BubbleMetadata.Builder.setAutoExpandBubble(boolean)

public boolean isNotificationSuppressed()

Returns:

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

See also: NotificationCompat.BubbleMetadata.Builder.setSuppressNotification(boolean)

public void setFlags(int flags)

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

Converts a NotificationCompat.BubbleMetadata to a platform-level .

Parameters:

compatMetadata: the NotificationCompat.BubbleMetadata to convert

Returns:

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

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

Converts a platform-level to a NotificationCompat.BubbleMetadata.

Parameters:

platformMetadata: the to convert

Returns:

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