Builder

class Builder(val context: Context, var id: Int = generateNotificationId())

Creates a new instance of the Builder class.

Author

Arnau Mora

Since

20210323

See also

Parameters

context

The context to create the notification from

id

The id of the notification, or if not set, a new id will be generated.

Constructors

Link copied to clipboard
fun Builder(context: Context, id: Int = generateNotificationId())

Functions

Link copied to clipboard

Adds a button to the notification

Adds a button to the notification.

Link copied to clipboard

Adds multiple buttons to the notification

Link copied to clipboard

Builds the notification

Link copied to clipboard

Builds the notification, and calls the show method.

Link copied to clipboard
fun setAlertOnce(alertOnce: Boolean = true): Notification.Builder

Sets if the notification should interrupt the user every time it's updated.

Link copied to clipboard
fun setPersistent(persistent: Boolean = true): Notification.Builder

Sets if the notification should be removable by the user

Link copied to clipboard

Sets a the channel id of the notification

Link copied to clipboard

Sets the desired color to the notification.

Link copied to clipboard

Sets the desired color from resources to the notification.

Link copied to clipboard

Sets a the icon of the notification

Link copied to clipboard

Sets an id to the notification

Link copied to clipboard

Sets the info message of the notification

fun withInfoText(@StringRes textRes: Int, vararg arguments: Any): Notification.Builder

Sets the info text of the notification from a resource

Link copied to clipboard

Sets the action of the notification

Link copied to clipboard

Sets the text of the notification when it's expanded

fun withLongText(@StringRes longTextRes: Int, vararg args: Any): Notification.Builder

Sets the text of the notification when it's expanded from a resource

Link copied to clipboard
fun withProgress(progress: ValueMax<Int>, persistent: Boolean = true): Notification.Builder
fun withProgress(progress: Int, max: Int, persistent: Boolean = true): Notification.Builder

Sets the progress of the notification. If progress is set to less than 0, it will be indeterminate

Link copied to clipboard

Sets the message of the notification

fun withText(@StringRes messageRes: Int, vararg arguments: Any): Notification.Builder

Sets the message of the notification from a resource

Link copied to clipboard

Sets the title of the notification

fun withTitle(@StringRes titleRes: Int, vararg arguments: Any): Notification.Builder

Sets the title of the notification from a resource

Properties

Link copied to clipboard
Link copied to clipboard
var alertOnce: Boolean = true
Link copied to clipboard
var channelId: String? = null
Link copied to clipboard
var color: Int? = null
Link copied to clipboard
Link copied to clipboard
var icon: Int? = null
Link copied to clipboard
var id: Int
Link copied to clipboard
var info: String? = null
Link copied to clipboard
var intent: PendingIntent? = null
Link copied to clipboard
var longText: String? = null
Link copied to clipboard
var persistent: Boolean = false
Link copied to clipboard
var progress: ValueMax<Int>? = null
Link copied to clipboard
var text: String? = null
Link copied to clipboard
var title: String? = null