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 |
|
<init>(notificationId: Int, @NonNull notification: Notification, foregroundServiceType: Int) Creates an instance of |
Public methods | |
---|---|
Boolean | |
Int | |
Notification | |
Int | |
Int |
hashCode() |
String |
toString() |
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
getForegroundServiceType
fun getForegroundServiceType(): Int
Return | |
---|---|
Int |
The foreground android.content.pm.ServiceInfo type |
getNotification
@NonNull fun getNotification(): Notification
Return | |
---|---|
Notification |
The user visible Notification |
hashCode
fun hashCode(): Int
toString
fun toString(): String