# Notification.BubbleMetadata

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#nestedclasses)\|[Inherited Constants](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#inhconstants)\|[Fields](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#lfields)\|[Methods](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#inhmethods)  

# Notification.BubbleMetadata

*** ** * ** ***

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

`
public
static
final

class
Notification.BubbleMetadata
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Parcelable](https://developer.android.com/reference/android/os/Parcelable)`


`

|---|-----------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.Notification.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 and an expanded state that displays an activity. These may be defined via[Builder.Builder(PendingIntent, Icon)](https://developer.android.com/reference/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/android/app/Notification.BubbleMetadata.Builder#Builder(java.lang.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.**

<br />

**See also:**

- [Notification.Builder.setBubbleMetadata(BubbleMetadata)](https://developer.android.com/reference/android/app/Notification.Builder#setBubbleMetadata(android.app.Notification.BubbleMetadata))

## Summary

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

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable) |-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) Descriptor bit used with[describeContents()](https://developer.android.com/reference/android/os/Parcelable#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor.                                                                                                                                            | | `int` | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE) Flag for use with[writeToParcel(Parcel, int)](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)): 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)`". | |

|                                                                                                                                                               ### Fields                                                                                                                                                               ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](https://developer.android.com/reference/android/os/Parcelable.Creator)`<`[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata)`>` | [CREATOR](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#CREATOR) <br /> |

|                                                                                                                                                                              ### Public methods                                                                                                                                                                               ||
|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                                | ` `[describeContents](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#describeContents())`() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.                                                 |
| ` boolean`                                                                            | ` `[getAutoExpandBubble](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getAutoExpandBubble())`() `                                                                                                                                                   |
| ` `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent) | ` `[getDeleteIntent](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getDeleteIntent())`() `                                                                                                                                                           |
| ` int`                                                                                | ` `[getDesiredHeight](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getDesiredHeight())`() `                                                                                                                                                         |
| ` int`                                                                                | ` `[getDesiredHeightResId](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getDesiredHeightResId())`() `                                                                                                                                               |
| ` `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)     | ` `[getIcon](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getIcon())`() `                                                                                                                                                                           |
| ` `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent) | ` `[getIntent](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getIntent())`() `                                                                                                                                                                       |
| ` `[String](https://developer.android.com/reference/java/lang/String)                 | ` `[getShortcutId](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getShortcutId())`() `                                                                                                                                                               |
| ` boolean`                                                                            | ` `[isBubbleSuppressable](https://developer.android.com/reference/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`                                                                            | ` `[isBubbleSuppressed](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#isBubbleSuppressed())`() ` Indicates whether the bubble is currently visually suppressed from the bubble stack.                                                                |
| ` boolean`                                                                            | ` `[isNotificationSuppressed](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#isNotificationSuppressed())`() ` Indicates whether the notification associated with the bubble is being visually suppressed from the notification shade.                 |
| ` void`                                                                               | ` `[writeToParcel](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` out, int flags) ` Flatten this object in to a Parcel.               |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` `[describeContents](https://developer.android.com/reference/android/os/Parcelable#describeContents())`() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.                                    | | ` abstract void` | ` `[writeToParcel](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel. | ||

## Fields

### CREATOR

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

```
public static final Creator<Notification.BubbleMetadata> CREATOR
```

<br />

<br />

## Public methods

### describeContents

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

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of[writeToParcel(android.os.Parcel, int)](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)), the return value of this method must include the[CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR)bit.

<br />

|                                                                                                                         Returns                                                                                                                         ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) <br /> |

### getAutoExpandBubble

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

```
public boolean getAutoExpandBubble ()
```

<br />

<br />

|                                  Returns                                   ||
|-----------|-----------------------------------------------------------------|
| `boolean` | whether this bubble should auto expand when it is posted <br /> |

**See also:**

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

### getDeleteIntent

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

```
public PendingIntent getDeleteIntent ()
```

<br />

<br />

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

### getDesiredHeight

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

```
public int getDesiredHeight ()
```

<br />

<br />

|                                                                                                                                     Returns                                                                                                                                     ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | the ideal height, in DPs, for the floating window that app content defined by[getIntent()](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getIntent())for this bubble. A value of 0 indicates a desired height has not been set. <br /> |

### getDesiredHeightResId

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

```
public int getDesiredHeightResId ()
```

<br />

<br />

|                                                                                                                                                Returns                                                                                                                                                 ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | the resId of ideal height for the floating window that app content defined by[getIntent()](https://developer.android.com/reference/android/app/Notification.BubbleMetadata#getIntent())for this bubble. A value of 0 indicates a res value has not been provided for the desired height. <br /> |

### getIcon

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

```
public Icon getIcon ()
```

<br />

<br />

|                                                                                                                                                                    Returns                                                                                                                                                                     ||
|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | 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/android/app/Notification.BubbleMetadata.Builder#Builder(java.lang.String)). <br /> |

### getIntent

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

```
public PendingIntent getIntent ()
```

<br />

<br />

|                                                                                                                                                                        Returns                                                                                                                                                                         ||
|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PendingIntent](https://developer.android.com/reference/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/android/app/Notification.BubbleMetadata.Builder#Builder(java.lang.String)). <br /> |

### getShortcutId

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

```
public String getShortcutId ()
```

<br />

<br />

|                                                                                                                                                                                                                                                Returns                                                                                                                                                                                                                                                ||
|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the shortcut id used for this bubble if created via[Builder.Builder(String)](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.Builder#Builder(java.lang.String))or null if created via[Builder.Builder(PendingIntent, Icon)](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.Builder#Builder(android.app.PendingIntent,%20android.graphics.drawable.Icon)). <br /> |

### isBubbleSuppressable

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

```
public boolean 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. 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/android/content/LocusId)set that matches a locus id set on the activity.

<br />

|                                                      Returns                                                       ||
|-----------|---------------------------------------------------------------------------------------------------------|
| `boolean` | whether this bubble should be suppressed when the same content is visible outside of the bubble. <br /> |

**See also:**

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

### isBubbleSuppressed

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

```
public boolean isBubbleSuppressed ()
```

Indicates whether the bubble is currently visually suppressed from the bubble stack.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

**See also:**

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

### isNotificationSuppressed

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

```
public boolean isNotificationSuppressed ()
```

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.

<br />

<br />

|                                         Returns                                          ||
|-----------|-------------------------------------------------------------------------------|
| `boolean` | whether this bubble should suppress the notification when it is posted <br /> |

**See also:**

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

### writeToParcel

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

```
public void writeToParcel (Parcel out, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

|                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `out`   | `Parcel`: The Parcel in which the object should be written. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                 |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE). Value is either`0`or a combination of[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES <br /> |