ForegroundInfo
public final class ForegroundInfo
The information required when a ListenableWorker runs in the context of a foreground service.
Summary
Public constructors |
|---|
ForegroundInfo(int notificationId, @NonNull Notification notification)Creates an instance of |
ForegroundInfo(Creates an instance of |
Public methods |
|
|---|---|
boolean |
|
int |
|
@NonNull Notification |
|
int |
|
int |
hashCode() |
String |
toString() |
Public constructors
ForegroundInfo
public ForegroundInfo(int notificationId, @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 constructor; otherwise, a default
foregroundServiceType of 0 will be used.
| Parameters | |
|---|---|
int notificationId |
The |
@NonNull Notification notification |
The |
ForegroundInfo
public ForegroundInfo(
int notificationId,
@NonNull Notification notification,
int foregroundServiceType
)
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 | |
|---|---|
int notificationId |
The |
@NonNull Notification notification |
The |
int foregroundServiceType |
The foreground |
Public methods
getForegroundServiceType
public int getForegroundServiceType()
| Returns | |
|---|---|
int |
The foreground |
getNotification
public @NonNull Notification getNotification()
| Returns | |
|---|---|
@NonNull Notification |
The user visible |
getNotificationId
public int getNotificationId()
| Returns | |
|---|---|
int |
The |