DownloadNotificationHelper


@UnstableApi
class DownloadNotificationHelper


Helper for creating download notifications.

Summary

Public constructors

DownloadNotificationHelper(context: Context!, channelId: String!)

Public functions

Notification!
buildDownloadCompletedNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?
)

Returns a notification for a completed download.

Notification!
buildDownloadFailedNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?
)

Returns a notification for a failed download.

Notification!
buildProgressNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?,
    downloads: (Mutable)List<Download!>!,
    @Requirements.RequirementFlags notMetRequirements: Int
)

Returns a progress notification for the given downloads.

Public constructors

DownloadNotificationHelper

DownloadNotificationHelper(context: Context!, channelId: String!)
Parameters
context: Context!

A context.

channelId: String!

The id of the notification channel to use.

Public functions

buildDownloadCompletedNotification

fun buildDownloadCompletedNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?
): Notification!

Returns a notification for a completed download.

Parameters
context: Context!

A context.

smallIcon: @DrawableRes Int

A small icon for the notifications.

contentIntent: PendingIntent?

An optional content intent to send when the notification is clicked.

message: String?

An optional message to display on the notification.

Returns
Notification!

The notification.

buildDownloadFailedNotification

fun buildDownloadFailedNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?
): Notification!

Returns a notification for a failed download.

Parameters
context: Context!

A context.

smallIcon: @DrawableRes Int

A small icon for the notifications.

contentIntent: PendingIntent?

An optional content intent to send when the notification is clicked.

message: String?

An optional message to display on the notification.

Returns
Notification!

The notification.

buildProgressNotification

fun buildProgressNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?,
    downloads: (Mutable)List<Download!>!,
    @Requirements.RequirementFlags notMetRequirements: Int
): Notification!

Returns a progress notification for the given downloads.

Parameters
context: Context!

A context.

smallIcon: @DrawableRes Int

A small icon for the notification.

contentIntent: PendingIntent?

An optional content intent to send when the notification is clicked.

message: String?

An optional message to display on the notification.

downloads: (Mutable)List<Download!>!

The downloads.

@Requirements.RequirementFlags notMetRequirements: Int

Any requirements for downloads that are not currently met.

Returns
Notification!

The notification.