# NotificationCompat.BubbleMetadata

# 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)

*** ** * ** ***

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

<br />

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

## Summary

|                                                                                                                                                 ### Nested types                                                                                                                                                  |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[NotificationCompat.BubbleMetadata.Builder](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata.Builder) Builder to construct a[BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata)object. |

|                                                                                 ### Public functions                                                                                 |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata)`?`                             | [fromPlatform](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#fromPlatform(android.app.Notification.BubbleMetadata))`(platformMetadata: `[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html)`?)` Converts a platform-level[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html)to a[NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata).                           |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                  | [getAutoExpandBubble](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#getAutoExpandBubble())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`?`                                                                                           | [getDeleteIntent](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#getDeleteIntent())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `@`[Dimension](https://developer.android.com/reference/kotlin/androidx/annotation/Dimension)`(unit = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getDesiredHeight](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#getDesiredHeight())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `@`[DimenRes](https://developer.android.com/reference/kotlin/androidx/annotation/DimenRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)             | [getDesiredHeightResId](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#getDesiredHeightResId())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [IconCompat](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat)`?`                                                                           | [getIcon](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#getIcon())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`?`                                                                                           | [getIntent](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#getIntent())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?`                                                                                                 | [getShortcutId](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#getShortcutId())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                  | [isNotificationSuppressed](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#isNotificationSuppressed())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `java-static `[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html)`?`                                                 | [toPlatform](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata#toPlatform(androidx.core.app.NotificationCompat.BubbleMetadata))`(compatMetadata: `[NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata)`?)` Converts a[NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata)to a platform-level[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html). |

## Public functions

### fromPlatform

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

```
java-static fun fromPlatform(platformMetadata: Notification.BubbleMetadata?): NotificationCompat.BubbleMetadata?
```

Converts a platform-level[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html)to a[NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata).  

|                                                                 Parameters                                                                 |
|--------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| `platformMetadata: `[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html)`?` | the[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html)to convert |

|                                                                  Returns                                                                   |
|--------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata)`?` | a[NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/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)  

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

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

|                                                                            See also                                                                            |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setAutoExpandBubble](https://developer.android.com/reference/kotlin/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)  

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

|                                          Returns                                           |
|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [PendingIntent](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)  

```
fun getDesiredHeight(): @Dimension(unit = 0) Int
```  

|                                                                                       Returns                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[Dimension](https://developer.android.com/reference/kotlin/androidx/annotation/Dimension)`(unit = 0) `[Int](https://kotlinlang.org/api/core/kotlin-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/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)  

```
fun getDesiredHeightResId(): @DimenRes Int
```  

|                                                                                 Returns                                                                                  |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[DimenRes](https://developer.android.com/reference/kotlin/androidx/annotation/DimenRes)` `[Int](https://kotlinlang.org/api/core/kotlin-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/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)  

```
fun getIcon(): IconCompat?
```  

|                                                  Returns                                                   |
|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [IconCompat](https://developer.android.com/reference/kotlin/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[Builder](https://developer.android.com/reference/kotlin/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)  

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

|                                          Returns                                           |
|--------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PendingIntent](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[Builder](https://developer.android.com/reference/kotlin/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)  

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

|                                       Returns                                        |
|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | the shortcut id used for this bubble if created via[Builder](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#Builder(java.lang.String))or null if created via[Builder](https://developer.android.com/reference/kotlin/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)  

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

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

|                                                                                See also                                                                                |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setSuppressNotification](https://developer.android.com/reference/kotlin/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)  

```
java-static fun toPlatform(compatMetadata: NotificationCompat.BubbleMetadata?): Notification.BubbleMetadata?
```

Converts a[NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata)to a platform-level[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html).  

|                                                                          Parameters                                                                          |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| `compatMetadata: `[NotificationCompat.BubbleMetadata](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata)`?` | the NotificationCompat.BubbleMetadata to convert |

|                                                        Returns                                                         |
|------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html)`?` | a[Notification.BubbleMetadata](https://developer.android.com/reference/android/app/Notification.BubbleMetadata.html)containing the same data if compatMetadata is non-null, otherwise null. |