class Wendy
How you interact with Wendy with PendingTask instances you create. Add tasks to Wendy to run, get a list of all the PendingTasks registered to Wendy, etc.
fun addTask(pendingTask: PendingTask, resolveErrorIfTaskExists: Boolean = true): Long
Call when you have a new PendingTask that you would like to register to Wendy to run. |
|
fun clear(): Unit
Stop the task runner and clear all of the PendingTasks added to Wendy. |
|
fun clearAsync(complete: () -> Unit?): Unit
Async version of clear. |
|
fun debug(enableDebug: Boolean = false): Wendy
Turn on and off debug log messages from Wendy. |
|
fun doesErrorExist(taskId: Long): Boolean
Convenient method to see if an error has been recorded for a PendingTask and has not been resolved yet. |
|
fun getAllErrors(): List<PendingTaskError>
Get all errors that currently exist for PendingTasks. |
|
fun getAllTasks(): List<PendingTask>
If you, for some reason, wish to receive a copy of all the PendingTask instances that still need to run successfully by Wendy, here is how you get them. |
|
fun getLatestError(taskId: Long): PendingTaskError?
How to check if an error has been recorded for a PendingTask. |
|
fun isTaskAbleToManuallyRun(taskId: Long): Boolean
Tells you if a PendingTask is able to run yet or not. |
|
fun recordError(taskId: Long, humanReadableErrorMessage: String?, errorId: String?): Unit
If you encounter an error while executing PendingTask.runTask in one of your PendingTasks, you can record it here to handle later in your app. This is usually used when your PendingTask encounters an error that requires the app user to fix (example: A string sent up to your API is too long. The user must shorten it up). |
|
fun resolveError(taskId: Long): Boolean
Mark a previously recorded error for a PendingTask as resolved. |
|
fun runTask(taskId: Long): Unit
Use this function along with manually run tasks to have Wendy run it for you. If it is successful, Wendy will take care of deleting it for you. |
|
fun runTasks(filter: RunAllTasksFilter?): Unit
Manually run all pending tasks. Wendy takes care of running this periodically for you, but you can manually run tasks here. |
val shared: Wendy
Short hand version of calling sharedInstance. |
fun init(context: Context, tasksFactory: PendingTasksFactory): Wendy
Initialize Wendy. It's recommended to do this in your Application class of your app. |
|
fun sharedInstance(): Wendy
Get singleton instance of Wendy. |