# NotificationCompat.BubbleMetadata

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/app/NotificationCompat.java+class:androidx.core.app.NotificationCompat.BubbleMetadata) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

*** ** * ** ***


```
public final class NotificationCompat.BubbleMetadata
```

<br />

*** ** * ** ***

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, `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#setIcon(androidx.core.graphics.drawable.IconCompat)` and an expanded state which is populated via `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#setIntent(android.app.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.**

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setBubbleMetadata(androidx.core.app.NotificationCompat.BubbleMetadata)` |   |

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder` Builder to construct a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata` object. |

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#fromPlatform(android.app.Notification.BubbleMetadata)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html platformMetadata)` Converts a platform-level `https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html` to a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata`. |
| `boolean` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#getAutoExpandBubble()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#getDeleteIntent()()` |
| `@https://developer.android.com/reference/androidx/annotation/Dimension(unit = 0) int` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#getDesiredHeight()()` |
| `@https://developer.android.com/reference/androidx/annotation/DimenRes int` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#getDesiredHeightResId()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#getIcon()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#getIntent()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#getShortcutId()()` |
| `boolean` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#isNotificationSuppressed()()` |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#toPlatform(androidx.core.app.NotificationCompat.BubbleMetadata)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata compatMetadata)` Converts a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata` to a platform-level `https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html`. |

## Public methods

### fromPlatform

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public static @Nullable NotificationCompat.BubbleMetadata fromPlatform(@Nullable Notification.BubbleMetadata platformMetadata)
```

Converts a platform-level `https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html` to a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html platformMetadata` | the `https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html` to convert |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata` | a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata` containing the same data if platformMetadata is non-null, otherwise null. |

### getAutoExpandBubble

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public boolean getAutoExpandBubble()
```

| Returns |
|---|---|
| `boolean` | whether this bubble should auto expand when it is posted. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#setAutoExpandBubble(boolean)` |   |

### getDeleteIntent

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public @Nullable PendingIntent getDeleteIntent()
```

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html` | the pending intent to send when the bubble is dismissed by a user, if one exists. |

### getDesiredHeight

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public @Dimension(unit = 0) int getDesiredHeight()
```

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Dimension(unit = 0) int` | the ideal height, in DPs, for the floating window that app content defined by `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#getIntent()` for this bubble. A value of 0 indicates a desired height has not been set. |

### getDesiredHeightResId

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public @DimenRes int getDesiredHeightResId()
```

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/DimenRes int` | the resId of ideal height for the floating window that app content defined by `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata#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](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public @Nullable IconCompat getIcon()
```

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat` | the icon that will be displayed for this bubble when it is collapsed, or null if the bubble is created via `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#Builder(java.lang.String)`. |

### getIntent

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public @Nullable PendingIntent getIntent()
```

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html` | the pending intent used to populate the floating window for this bubble, or null if this bubble is created via `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#Builder(java.lang.String)`. |

### getShortcutId

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
public @Nullable String getShortcutId()
```

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | the shortcut id used for this bubble if created via `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#Builder(java.lang.String)` or null if created via `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#Builder(android.app.PendingIntent,androidx.core.graphics.drawable.IconCompat)`. |

### isNotificationSuppressed

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public boolean isNotificationSuppressed()
```

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

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#setSuppressNotification(boolean)` |   |

### toPlatform

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public static @Nullable Notification.BubbleMetadata toPlatform(@Nullable NotificationCompat.BubbleMetadata compatMetadata)
```

Converts a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata` to a platform-level `https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.BubbleMetadata compatMetadata` | the NotificationCompat.BubbleMetadata to convert |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html` | a `https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html` containing the same data if compatMetadata is non-null, otherwise null. |