# DownloadNotificationHelper

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

*** ** * ** ***


```
@UnstableApi
public final class DownloadNotificationHelper
```

<br />

*** ** * ** ***

Helper for creating download notifications.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadNotificationHelper#DownloadNotificationHelper(android.content.Context,java.lang.String)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/java/lang/String.html channelId)` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadNotificationHelper#buildDownloadCompletedNotification(android.content.Context,int,android.app.PendingIntent,java.lang.String)( https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/DrawableRes int smallIcon, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html contentIntent, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message )` Returns a notification for a completed download. |
| `https://developer.android.com/reference/android/app/Notification.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadNotificationHelper#buildDownloadFailedNotification(android.content.Context,int,android.app.PendingIntent,java.lang.String)( https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/DrawableRes int smallIcon, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html contentIntent, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message )` Returns a notification for a failed download. |
| `https://developer.android.com/reference/android/app/Notification.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadNotificationHelper#buildProgressNotification(android.content.Context,int,android.app.PendingIntent,java.lang.String,java.util.List<androidx.media3.exoplayer.offline.Download>,int)( https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/DrawableRes int smallIcon, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html contentIntent, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/offline/Download> downloads, @https://developer.android.com/reference/androidx/media3/exoplayer/scheduler/Requirements.RequirementFlags int notMetRequirements )` Returns a progress notification for the given downloads. |

## Public constructors

### DownloadNotificationHelper

```
public DownloadNotificationHelper(Context context, String channelId)
```

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A context. |
| `https://developer.android.com/reference/java/lang/String.html channelId` | The id of the notification channel to use. |

## Public methods

### buildDownloadCompletedNotification

```
public Notification buildDownloadCompletedNotification(
    Context context,
    @DrawableRes int smallIcon,
    @Nullable PendingIntent contentIntent,
    @Nullable String message
)
```

Returns a notification for a completed download.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A context. |
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int smallIcon` | A small icon for the notifications. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html contentIntent` | An optional content intent to send when the notification is clicked. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | An optional message to display on the notification. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html` | The notification. |

### buildDownloadFailedNotification

```
public Notification buildDownloadFailedNotification(
    Context context,
    @DrawableRes int smallIcon,
    @Nullable PendingIntent contentIntent,
    @Nullable String message
)
```

Returns a notification for a failed download.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A context. |
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int smallIcon` | A small icon for the notifications. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html contentIntent` | An optional content intent to send when the notification is clicked. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | An optional message to display on the notification. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html` | The notification. |

### buildProgressNotification

```
public Notification buildProgressNotification(
    Context context,
    @DrawableRes int smallIcon,
    @Nullable PendingIntent contentIntent,
    @Nullable String message,
    List<Download> downloads,
    @Requirements.RequirementFlags int notMetRequirements
)
```

Returns a progress notification for the given downloads.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A context. |
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int smallIcon` | A small icon for the notification. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/PendingIntent.html contentIntent` | An optional content intent to send when the notification is clicked. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | An optional message to display on the notification. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/offline/Download> downloads` | The downloads. |
| `@https://developer.android.com/reference/androidx/media3/exoplayer/scheduler/Requirements.RequirementFlags int notMetRequirements` | Any requirements for downloads that are not currently met. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html` | The notification. |