Interface BackgroundWorker
Implemented by an application class to perform constraint-aware background work
scheduled through BackgroundWork#schedule(WorkRequest).
The implementing class MUST have a public no-argument constructor: the platform may reconstruct a fresh instance after the app process has been killed and cold launched to run the work, so no state from the foreground app is available. Pass any required state through the work request input data.
See also
-
BackgroundWork
-
WorkRequest
-
Method Summary
-
Method Details
-
performWork
void performWork(String workId, Map<String, String> inputData, long deadline, Callback<Boolean> onComplete) Performs the background work. The implementation should call
onCompletewithBoolean.TRUEon success orBoolean.FALSEto request that the platform retry the work later. The work must finish beforedeadline; if it does not, the platform may terminate it.Parameters
-
workId: the id of the work request being executed -
inputData: the immutable input data supplied to the work request -
deadline: the time in milliseconds since the epoch by which the work must finish -
onComplete: callback invoked with the outcome (true for success, false to retry)
-
-