# Notification.BubbleMetadata

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# BubbleMetadata

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/app/Notification.BubbleMetadata "View this page in Java")  

```
class BubbleMetadata : Parcelable
```

|---|------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                     ||
| ↳ | [android.app.Notification.BubbleMetadata](https://developer.android.com/reference/kotlin/android/app/Notification.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 and an expanded state that displays an activity. These may be defined via[Builder.Builder(PendingIntent, Icon)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#Builder(android.app.PendingIntent,%20android.graphics.drawable.Icon))or they may be defined via an existing shortcut using[Builder.Builder(String)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#Builder(kotlin.String)).
**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 activity will be invoked and displayed.**

## Summary

|                                                                                                                   Nested classes                                                                                                                    ||
|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [Builder](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder) Builder to construct a[BubbleMetadata](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#)object. |

| Inherited constants ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) <br /> Descriptor bit used with[describeContents()](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor. <br />                                                                                                                                                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int) <br /> Flag for use with[writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

|                                                                                                                                                                                                                 Public methods                                                                                                                                                                                                                  ||
|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                   | [describeContents](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#describeContents())`()` <br />                                                                                                                                                                                                          |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)           | [getAutoExpandBubble](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getAutoExpandBubble())`()` <br />                                                                                                                                                                                                    |
| [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)?   | [getDeleteIntent](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getDeleteIntent())`()` <br />                                                                                                                                                                                                            |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                   | [getDesiredHeight](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getDesiredHeight())`()` <br />                                                                                                                                                                                                          |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                   | [getDesiredHeightResId](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getDesiredHeightResId())`()` <br />                                                                                                                                                                                                |
| [Icon](https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#)? | [getIcon](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getIcon())`()` <br />                                                                                                                                                                                                                            |
| [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)?   | [getIntent](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getIntent())`()` <br />                                                                                                                                                                                                                        |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?            | [getShortcutId](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getShortcutId())`()` <br />                                                                                                                                                                                                                |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)           | [isBubbleSuppressable](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#isBubbleSuppressable())`()` Indicates whether the bubble should be visually suppressed from the bubble stack if the user is viewing the same content outside of the bubble.                                                         |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)           | [isBubbleSuppressed](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#isBubbleSuppressed())`()` Indicates whether the bubble is currently visually suppressed from the bubble stack.                                                                                                                        |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)           | [isNotificationSuppressed](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#isNotificationSuppressed())`()` Indicates whether the notification associated with the bubble is being visually suppressed from the notification shade.                                                                         |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                 | [writeToParcel](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`out:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> |

|                                                                                                                                                                                        Properties                                                                                                                                                                                         ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[Notification.BubbleMetadata](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#)!\> | [CREATOR](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#CREATOR:android.os.Parcelable.Creator) <br /> |

## Public methods

### describeContents

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun describeContents(): Int
```

|                                                                                                                                                                               Return                                                                                                                                                                               ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) |

### getAutoExpandBubble

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getAutoExpandBubble(): Boolean
```

|                                                                    Return                                                                    ||
|------------------------------------------------------------------------------------|----------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | whether this bubble should auto expand when it is posted |

**See Also**

- [android.app.Notification.BubbleMetadata.Builder#setAutoExpandBubble(boolean)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#setAutoExpandBubble(kotlin.Boolean))  

### getDeleteIntent

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getDeleteIntent(): PendingIntent?
```

|                                                                                                Return                                                                                                 ||
|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)? | the pending intent to send when the bubble is dismissed by a user, if one exists This value may be`null`. |

### getDesiredHeight

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getDesiredHeight(): Int
```

|                                                                                                                                                                        Return                                                                                                                                                                        ||
|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the ideal height, in DPs, for the floating window that app content defined by[getIntent()](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getIntent())for this bubble. A value of 0 indicates a desired height has not been set. |

### getDesiredHeightResId

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getDesiredHeightResId(): Int
```

|                                                                                                                                                                                   Return                                                                                                                                                                                    ||
|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the resId of ideal height for the floating window that app content defined by[getIntent()](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata#getIntent())for this bubble. A value of 0 indicates a res value has not been provided for the desired height. |

### getIcon

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getIcon(): Icon?
```

|                                                                                                                                                                          Return                                                                                                                                                                           ||
|----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Icon](https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#)? | the icon that will be displayed for this bubble when it is collapsed, or`null`if the bubble is created via[Builder.Builder(String)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#Builder(kotlin.String)). |

### getIntent

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getIntent(): PendingIntent?
```

|                                                                                                                                                                           Return                                                                                                                                                                            ||
|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)? | the pending intent used to populate the floating window for this bubble, or null if this bubble is created via[Builder.Builder(String)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#Builder(kotlin.String)). |

### getShortcutId

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getShortcutId(): String?
```

|                                                                                                                                                                                                                                                          Return                                                                                                                                                                                                                                                          ||
|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | the shortcut id used for this bubble if created via[Builder.Builder(String)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#Builder(kotlin.String))or null if created via[Builder.Builder(PendingIntent, Icon)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#Builder(android.app.PendingIntent,%20android.graphics.drawable.Icon)). |

### isBubbleSuppressable

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun isBubbleSuppressable(): Boolean
```

Indicates whether the bubble should be visually suppressed from the bubble stack if the user is viewing the same content outside of the bubble. For example, the user has a bubble with Alice and then opens up the main app and navigates to Alice's page.

To match the activity and the bubble notification, the bubble notification should have a[LocusId](https://developer.android.com/reference/kotlin/android/content/LocusId.html#)set that matches a locus id set on the activity.

|                                                                                        Return                                                                                        ||
|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | whether this bubble should be suppressed when the same content is visible outside of the bubble. |

**See Also**

- [android.app.Notification.BubbleMetadata.Builder#setSuppressableBubble(boolean)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#setSuppressableBubble(kotlin.Boolean))  

### isBubbleSuppressed

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun isBubbleSuppressed(): Boolean
```

Indicates whether the bubble is currently visually suppressed from the bubble stack.  
**See Also**

- [android.app.Notification.BubbleMetadata.Builder#setSuppressableBubble(boolean)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#setSuppressableBubble(kotlin.Boolean))  

### isNotificationSuppressed

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun isNotificationSuppressed(): Boolean
```

Indicates whether the notification associated with the bubble is being visually suppressed from the notification shade. When`true`the notification is hidden, when`false`the notification shows as normal.

Apps sending bubbles may set this flag so that the bubble is posted**without**the associated notification in the notification shade.

Generally the app should only set this flag if the user has performed an action to request or create a bubble, or if the user has seen the content in the notification and the notification is no longer relevant.

The system will update this flag with`true`to hide the notification from the user once the bubble has been expanded.

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | whether this bubble should suppress the notification when it is posted |

**See Also**

- [android.app.Notification.BubbleMetadata.Builder#setSuppressNotification(boolean)](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#setSuppressNotification(kotlin.Boolean))  

### writeToParcel

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun writeToParcel(
    out: Parcel, 
    flags: Int
): Unit
```

|                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                     ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | The Parcel in which the object should be written. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Additional flags about how the object should be written. May be 0 or[PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int). Value is either`0`or a combination of[android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |

## Properties

### CREATOR

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CREATOR: Parcelable.Creator<Notification.BubbleMetadata!>
```