Skip to content
Nathan S edited this page Jun 16, 2020 · 2 revisions

Each application has a task manager that allows to create and run "tasks", performing actions in the background.

To create a task, simply make a class extending the task type you want to do to reimplement the virtual methods. Then, instantiate the task each time you want to run it and call start() on the instance you created.

You should not need to use the task manager directly, as the tasks are responsible for registering themselves (when start() is called) and taking care of their own lifecycle.

Repeating tasks

A RepeatingTask is a task that runs repeatedly on the main thread at a given internal. You can use them to repeatedly refresh data that do NOT need actual asynchronous work. Your repeating task WILL block the whole application if you block the run() method. Reading a file is fine, accessing network is probably not.

Background tasks

Actual background tasks (as in with their own thread) are yet to be written - the design will be similar to Android's AsyncTask class to easily synchronize the background thread and the UI thread.

Clone this wiki locally