ForegroundInfo

public final class ForegroundInfo
extends Object

java.lang.Object
   ↳ androidx.work.ForegroundInfo


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

Summary

Public constructors

ForegroundInfo(Notification notification)

Creates an instance of ForegroundInfo with a Notification.

ForegroundInfo(Notification notification, int foregroundServiceType)

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

Public methods

boolean equals(Object other)
int getForegroundServiceType()
Notification getNotification()
int hashCode()
String toString()

Inherited methods

Public constructors

ForegroundInfo

public ForegroundInfo (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 Service

ForegroundInfo

public ForegroundInfo (Notification notification, 
                int foregroundServiceType)

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

Parameters
notification Notification: The Notification

foregroundServiceType int: The foreground Service type

Public methods

equals

public boolean equals (Object other)

Parameters
other Object

Returns
boolean

getForegroundServiceType

public int getForegroundServiceType ()

Returns
int The Foreground service notification type

getNotification

public Notification getNotification ()

Returns
Notification The user visible Notification

hashCode

public int hashCode ()

Returns
int

toString

public String toString ()

Returns
String