# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# Notification.BubbleMetadata.Builder

`public static final class Notification.BubbleMetadata.Builder`
`extends Object` ``

java.lang.Object
↳ | android.app.Notification.BubbleMetadata.Builder

Builder to construct a `BubbleMetadata` object.

## Summary

### Public constructors
`Builder()` This constructor is deprecated. use `Builder#Builder(String)` for a bubble created via a `ShortcutInfo` or `Builder#Builder(PendingIntent, Icon)` for a bubble created via a `PendingIntent`.
`Builder(String shortcutId)` Creates a `BubbleMetadata.Builder` based on a `ShortcutInfo`.
`Builder(PendingIntent intent, Icon icon)` Creates a `BubbleMetadata.Builder` based on the provided intent and icon.

### Public methods
`Notification.BubbleMetadata` | `build()` Creates the `BubbleMetadata` defined by this builder.
`Notification.BubbleMetadata.Builder` | `setAutoExpandBubble(boolean shouldExpand)` Sets whether the bubble will be posted in its expanded state.
`Notification.BubbleMetadata.Builder` | `setDeleteIntent(PendingIntent deleteIntent)` Sets an intent to send when this bubble is explicitly removed by the user.
`Notification.BubbleMetadata.Builder` | `setDesiredHeight(int height)` Sets the desired height in DPs for the expanded content of the bubble.
`Notification.BubbleMetadata.Builder` | `setDesiredHeightResId(int heightResId)` Sets the desired height via resId for the expanded content of the bubble.
`Notification.BubbleMetadata.Builder` | `setIcon(Icon icon)` Sets the icon for the bubble.
`Notification.BubbleMetadata.Builder` | `setIntent(PendingIntent intent)` Sets the intent for the bubble.
`Notification.BubbleMetadata.Builder` | `setSuppressNotification(boolean shouldSuppressNotif)` Sets whether the bubble will be posted without the associated notification in the notification shade.
`Notification.BubbleMetadata.Builder` | `setSuppressableBubble(boolean suppressBubble)` Indicates whether the bubble should be visually suppressed from the bubble stack if the user is viewing the same content outside of the bubble.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### Builder

    public Builder ()

This constructor is deprecated.
use `Builder#Builder(String)` for a bubble created via a `ShortcutInfo` or `Builder#Builder(PendingIntent, Icon)` for a bubble created via a `PendingIntent`.

### Builder

    public Builder (String shortcutId)

Creates a `BubbleMetadata.Builder` based on a `ShortcutInfo`. To create a shortcut bubble, ensure that the shortcut associated with the provided is published as a dynamic shortcut that was built with `ShortcutInfo.Builder#setLongLived(boolean)` being true, otherwise your notification will not be able to bubble.

The shortcut icon will be used to represent the bubble when it is collapsed.

The shortcut activity will be used when the bubble is expanded. This will display the shortcut activity in a floating window over the existing foreground activity.

When the activity is launched from a bubble, `Activity#isLaunchedFromBubble()` will return with `true`.

If the shortcut has not been published when the bubble notification is sent, no bubble will be produced. If the shortcut is deleted while the bubble is active, the bubble will be removed.

Throws
`NullPointerException` | if shortcutId is null.

See also:

- `ShortcutInfo`
- `ShortcutInfo.Builder.setLongLived(boolean)`
- `ShortcutManager.addDynamicShortcuts(List)`

### Builder

    public Builder (PendingIntent intent,
                    Icon icon)

Creates a `BubbleMetadata.Builder` based on the provided intent and icon.

The icon will be used to represent the bubble when it is collapsed. An icon should be representative of the content within the bubble. If your app produces multiple bubbles, the icon should be unique for each of them.

The intent that will be used when the bubble is expanded. This will display the app content in a floating window over the existing foreground activity. The intent should point to a resizable activity.

When the activity is launched from a bubble, `Activity#isLaunchedFromBubble()` will return with `true`.

Note that the pending intent used here requires PendingIntent.FLAG_MUTABLE.

Parameters
`intent` | `PendingIntent`: This value cannot be `null`.
`icon` | `Icon`: This value cannot be `null`.

Throws
`NullPointerException` | if intent is null.
`NullPointerException` | if icon is null.

## Public methods

### build

    public Notification.BubbleMetadata build ()

Creates the `BubbleMetadata` defined by this builder.

Returns
`Notification.BubbleMetadata` | This value cannot be `null`.

Throws
`NullPointerException` | if required elements have not been set.

### setAutoExpandBubble

    public Notification.BubbleMetadata.Builder setAutoExpandBubble (boolean shouldExpand)

Sets whether the bubble will be posted in its expanded state.

This flag has no effect if the app posting the bubble is not in the foreground. The app is considered foreground if it is visible and on the screen, note that a foreground service does not qualify.

Generally, this flag should only be set if the user has performed an action to request or create a bubble.

Setting this flag is optional; it defaults to false.

Parameters
`shouldExpand` | `boolean`

Returns
`Notification.BubbleMetadata.Builder` | This value cannot be `null`.

### setDeleteIntent

    public Notification.BubbleMetadata.Builder setDeleteIntent (PendingIntent deleteIntent)

Sets an intent to send when this bubble is explicitly removed by the user.

Setting a delete intent is optional.

Parameters
`deleteIntent` | `PendingIntent`: This value may be `null`.

Returns
`Notification.BubbleMetadata.Builder` | This value cannot be `null`.

### setDesiredHeight

    public Notification.BubbleMetadata.Builder setDesiredHeight (int height)

Sets the desired height in DPs for the expanded content of the bubble.

This height may not be respected if there is not enough space on the screen or if the provided height is too small to be useful.

If `setDesiredHeightResId(int)` was previously called on this builder, the previous value set will be cleared after calling this method, and this value will be used instead.

A desired height (in DPs or via resID) is optional.

Parameters
`height` | `int`

Returns
`Notification.BubbleMetadata.Builder` | This value cannot be `null`.

See also:

- `setDesiredHeightResId(int)`

### setDesiredHeightResId

    public Notification.BubbleMetadata.Builder setDesiredHeightResId (int heightResId)

Sets the desired height via resId for the expanded content of the bubble.

This height may not be respected if there is not enough space on the screen or if the provided height is too small to be useful.

If `setDesiredHeight(int)` was previously called on this builder, the previous value set will be cleared after calling this method, and this value will be used instead.

A desired height (in DPs or via resID) is optional.

Parameters
`heightResId` | `int`

Returns
`Notification.BubbleMetadata.Builder` | This value cannot be `null`.

See also:

- `setDesiredHeight(int)`

### setIcon

    public Notification.BubbleMetadata.Builder setIcon (Icon icon)

Sets the icon for the bubble. Can only be used if the bubble was created via `Builder#Builder(PendingIntent, Icon)`.

The icon will be used to represent the bubble when it is collapsed. An icon should be representative of the content within the bubble. If your app produces multiple bubbles, the icon should be unique for each of them.

It is recommended to use an `Icon` of type `Icon#TYPE_URI` or `Icon#TYPE_URI_ADAPTIVE_BITMAP`

Parameters
`icon` | `Icon`: This value cannot be `null`.

Returns
`Notification.BubbleMetadata.Builder` |

Throws
`NullPointerException` | if icon is null.
`IllegalStateException` | if this builder was created via `Builder#Builder(String)`.

### setIntent

    public Notification.BubbleMetadata.Builder setIntent (PendingIntent intent)

Sets the intent for the bubble.

The intent that will be used when the bubble is expanded. This will display the app content in a floating window over the existing foreground activity. The intent should point to a resizable activity.

Parameters
`intent` | `PendingIntent`: This value cannot be `null`.

Returns
`Notification.BubbleMetadata.Builder` |

Throws
`NullPointerException` | if intent is null.
`IllegalStateException` | if this builder was created via `Builder#Builder(String)`.

### setSuppressNotification

    public Notification.BubbleMetadata.Builder setSuppressNotification (boolean shouldSuppressNotif)

Sets whether the bubble will be posted without the associated notification in the notification shade.

Generally, this flag should only be set 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.

Setting this flag is optional; it defaults to false.

Parameters
`shouldSuppressNotif` | `boolean`

Returns
`Notification.BubbleMetadata.Builder` | This value cannot be `null`.

### setSuppressableBubble

    public Notification.BubbleMetadata.Builder setSuppressableBubble (boolean suppressBubble)

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 locus id set that matches a locus id set on the activity. `Notification.Builder#setLocusId(LocusId)` `Activity#setLocusContext(LocusId, Bundle)`

Parameters
`suppressBubble` | `boolean`

Returns
`Notification.BubbleMetadata.Builder` | This value cannot be `null`.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*