ForegroundInfo


class ForegroundInfo


The information required when a ListenableWorker runs in the context of a foreground service.

Summary

Public constructors

ForegroundInfo(notificationId: Int, notification: Notification)

Creates an instance of ForegroundInfo with a Notification.

ForegroundInfo(
    notificationId: Int,
    notification: Notification,
    foregroundServiceType: Int
)

Creates an instance of ForegroundInfo with a Notification and foreground android.app.Service type.

Public constructors

ForegroundInfo

Added in 2.3.0
ForegroundInfo(notificationId: Int, notification: Notification)

Creates an instance of ForegroundInfo with a Notification.

On API 29 and above, you can specify a foregroundServiceType by using the ForegroundInfo constructor; otherwise, a default foregroundServiceType of 0 will be used.

Parameters
notificationId: Int

The Notification id

notification: Notification

The Notification to show when the Worker is running in the context of a foreground android.app.Service

ForegroundInfo

Added in 2.3.0
ForegroundInfo(
    notificationId: Int,
    notification: Notification,
    foregroundServiceType: Int
)

Creates an instance of ForegroundInfo with a Notification and foreground android.app.Service type. For more information look at android.app.Service#startForeground(int, Notification, int).

Parameters
notificationId: Int

The Notification id

notification: Notification

The Notification

foregroundServiceType: Int

The foreground android.content.pm.ServiceInfo type

Public functions

equals

fun equals(o: Any!): Boolean

getForegroundServiceType

Added in 2.3.0
fun getForegroundServiceType(): Int
Returns
Int

The foreground android.content.pm.ServiceInfo type

getNotification

Added in 2.3.0
fun getNotification(): Notification
Returns
Notification

The user visible Notification

getNotificationId

Added in 2.3.0
fun getNotificationId(): Int
Returns
Int

The Notification id to be used

hashCode

fun hashCode(): Int

toString

fun toString(): String!