Google berkomitmen untuk mendorong terwujudnya keadilan ras bagi komunitas Kulit Hitam. Lihat caranya.

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>(notificationId: Int, @NonNull notification: Notification)

Creates an instance of ForegroundInfo with a Notification.

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

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

Public methods
Boolean
equals(other: Any?)

Int

Notification

Int

Int

String

Public constructors

<init>

ForegroundInfo(
    notificationId: Int,
    @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(int, Notification, int) 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

<init>

ForegroundInfo(
    notificationId: Int,
    @NonNull 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 methods

equals

fun equals(other: Any?): Boolean

getForegroundServiceType

fun getForegroundServiceType(): Int
Return
Int The foreground android.content.pm.ServiceInfo type

getNotification

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

getNotificationId

fun getNotificationId(): Int
Return
Int The Notification id to be used

hashCode

fun hashCode(): Int

toString

fun toString(): String