# PlayerNotificationManager.NotificationListener

Artifact: [androidx.media3:media3-ui](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/ui/PlayerNotificationManager.java+class:androidx.media3.ui.PlayerNotificationManager.NotificationListener)

*** ** * ** ***


```
public interface PlayerNotificationManager.NotificationListener
```

<br />

*** ** * ** ***

A listener for changes to the notification.

## Summary

| ### Public methods |
|---|---|
| `default void` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.NotificationListener#onNotificationCancelled(int,boolean)(int notificationId, boolean dismissedByUser)` Called after the notification has been cancelled. |
| `default void` | `https://developer.android.com/reference/androidx/media3/ui/PlayerNotificationManager.NotificationListener#onNotificationPosted(int,android.app.Notification,boolean)( int notificationId, https://developer.android.com/reference/android/app/Notification.html notification, boolean ongoing )` Called each time after the notification has been posted. |

## Public methods

### onNotificationCancelled

```
default void onNotificationCancelled(int notificationId, boolean dismissedByUser)
```

Called after the notification has been cancelled.

| Parameters |
|---|---|
| `int notificationId` | The id of the notification which has been cancelled. |
| `boolean dismissedByUser` | `true` if the notification is cancelled because the user dismissed the notification. |

### onNotificationPosted

```
default void onNotificationPosted(
    int notificationId,
    Notification notification,
    boolean ongoing
)
```

Called each time after the notification has been posted.

For a service, the `ongoing` flag can be used as an indicator as to whether it should be in the foreground.

| Parameters |
|---|---|
| `int notificationId` | The id of the notification which has been posted. |
| `https://developer.android.com/reference/android/app/Notification.html notification` | The `https://developer.android.com/reference/android/app/Notification.html`. |
| `boolean ongoing` | Whether the notification is ongoing. |