The Android Developer Challenge is back! Submit your idea before December 2.

ForegroundInfo

class ForegroundInfo
kotlin.Any
   ↳ androidx.work.ForegroundInfo

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

Summary

Public constructors

<init>(@NonNull notification: Notification)

Creates an instance of ForegroundInfo with a Notification.

<init>(@NonNull notification: Notification, foregroundServiceType: Int)

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

Public methods

Boolean
equals(@Nullable other: Any?)

Int

Notification

Int

String

Public constructors

<init>

ForegroundInfo(@NonNull notification: Notification)

Creates an instance of ForegroundInfo with a Notification.

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

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

<init>

ForegroundInfo(@NonNull notification: Notification, foregroundServiceType: Int)

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

Parameters
notification Notification: The Notification
foregroundServiceType Notification: The foreground android.app.Service type

Public methods

equals

fun equals(@Nullable other: Any?): Boolean

getForegroundServiceType

fun getForegroundServiceType(): Int
Return
Int: The Foreground service notification type

getNotification

@NonNull fun getNotification(): Notification
Return
Notification: The user visible Notification

hashCode

fun hashCode(): Int

toString

@NonNull fun toString(): String