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.
Wendy works in a FIFO order. Your task gets added to the end of the queue of tasks to run.
Note: If you attempt to add a PendingTask instance that has the same PendingTask.tag and PendingTask.dataId as another PendingTask already added to Wendy, your request (including calling the task runner listener) will be ignored (except for the exception below in that there was an error recorded previously for a PendingTask).
Note: If you attempt to add a PendingTask instance that has the same PendingTask.tag and PendingTask.dataId as another PendingTask already added to Wendy that previously had an error recorded for it, that error will be marked as resolved (by internally calling Wendy.resolveError.
pendingTask
- Task you want to add to Wendy.
RuntimeException
- Wendy will check to make sure that you have remembered to add your argument's PendingTask subclass to your instance of PendingTasksFactory when you call this method. If your PendingTasksFactory returns null (which probably means that you forgot to include a PendingTask) then an RuntimeException will be thrown.
IllegalArgumentException
- If your PendingTask subclass does not follow the enforced best practice of: All subclasses of a PendingTask must all have a groupId or none of them have a groupId.