JobServiceEngine
abstract class JobServiceEngine
kotlin.Any | |
↳ | android.app.job.JobServiceEngine |
Helper for implementing a android.app.Service
that interacts with JobScheduler
. This is not intended for use by regular applications, but allows frameworks built on top of the platform to create their own android.app.Service
that interact with JobScheduler
as well as add in additional functionality. If you just want to execute jobs normally, you should instead be looking at JobService
.
Summary
Public constructors | |
---|---|
JobServiceEngine(service: Service!) Create a new engine, ready for use. |
Public methods | |
---|---|
IBinder! |
Retrieve the engine's IPC interface that should be returned by |
open Unit |
jobFinished(params: JobParameters!, needsReschedule: Boolean) Call in to engine to report that a job has finished executing. |
open Unit |
onNetworkChanged(params: JobParameters) Engine's report that the network for the job has changed. |
abstract Boolean |
onStartJob(params: JobParameters!) Engine's report that a job has started. |
abstract Boolean |
onStopJob(params: JobParameters!) Engine's report that a job has stopped. |
open Unit |
setNotification(params: JobParameters, notificationId: Int, notification: Notification, jobEndNotificationPolicy: Int) Give JobScheduler a notification to tie to this job's lifecycle. |
open Unit |
updateEstimatedNetworkBytes(params: JobParameters, item: JobWorkItem?, downloadBytes: Long, uploadBytes: Long) Call in to engine to report data transfer progress. |
open Unit |
updateTransferredNetworkBytes(params: JobParameters, item: JobWorkItem?, downloadBytes: Long, uploadBytes: Long) Call in to engine to report data transfer progress. |
Public constructors
JobServiceEngine
JobServiceEngine(service: Service!)
Create a new engine, ready for use.
Parameters | |
---|---|
service |
Service!: The Service that is creating this engine and in which it will run. |
Public methods
getBinder
fun getBinder(): IBinder!
Retrieve the engine's IPC interface that should be returned by Service.onBind(Intent)
.
jobFinished
open fun jobFinished(
params: JobParameters!,
needsReschedule: Boolean
): Unit
Call in to engine to report that a job has finished executing. See JobService.jobFinished(JobParameters, boolean)
for more information.
onNetworkChanged
open fun onNetworkChanged(params: JobParameters): Unit
Engine's report that the network for the job has changed.
Parameters | |
---|---|
params |
JobParameters: This value cannot be null . |
onStartJob
abstract fun onStartJob(params: JobParameters!): Boolean
Engine's report that a job has started. See JobService.onStartJob
for more information.
onStopJob
abstract fun onStopJob(params: JobParameters!): Boolean
Engine's report that a job has stopped. See JobService.onStopJob
for more information.
setNotification
open fun setNotification(
params: JobParameters,
notificationId: Int,
notification: Notification,
jobEndNotificationPolicy: Int
): Unit
Give JobScheduler a notification to tie to this job's lifecycle.
Parameters | |
---|---|
params |
JobParameters: This value cannot be null . |
notification |
Notification: This value cannot be null . |
jobEndNotificationPolicy |
Int: Value is android.app.job.JobService#JOB_END_NOTIFICATION_POLICY_DETACH , or android.app.job.JobService#JOB_END_NOTIFICATION_POLICY_REMOVE |
updateEstimatedNetworkBytes
open fun updateEstimatedNetworkBytes(
params: JobParameters,
item: JobWorkItem?,
downloadBytes: Long,
uploadBytes: Long
): Unit
Call in to engine to report data transfer progress.
Parameters | |
---|---|
params |
JobParameters: This value cannot be null . |
item |
JobWorkItem?: This value may be null . |
downloadBytes |
Long: Value is a non-negative number of bytes. |
uploadBytes |
Long: Value is a non-negative number of bytes. |
updateTransferredNetworkBytes
open fun updateTransferredNetworkBytes(
params: JobParameters,
item: JobWorkItem?,
downloadBytes: Long,
uploadBytes: Long
): Unit
Call in to engine to report data transfer progress.
Parameters | |
---|---|
params |
JobParameters: This value cannot be null . |
item |
JobWorkItem?: This value may be null . |
downloadBytes |
Long: Value is a non-negative number of bytes. |
uploadBytes |
Long: Value is a non-negative number of bytes. |