-
Notifications
You must be signed in to change notification settings - Fork 16
Home
Chronos is a minimalistic library for Android developers, that helps running background tasks with respect to GUI elements lifecycles.
Basically, any time you need to do some job in a background thread, and return its result to the UI thread. Most common examples are networking and database requests. Though Chronos is not limited by these two examples, as it is a container for long-running task, and the task may contain any kind of business logic within it.
- It takes away all the job of delivering background tasks results to the UI thread, so that you may fully concentrate on business logic.
- It handles properly lifecycles events. Results delivery are guaranteed to happen only when Activity or Fragment is resumed, and no result will be lost while it is not on screen (the only exception is a case when an app runs low on memory – in that case Chronos would try to free as much memory as possible).
- It prevents memory leaks. Even if you have dozens of Activities, Chronos would let Garbage Collector destroy unused Activities, in the same time it will continue running background tasks, and collect results to deliver it when Activities are on screen once again.
- It is robust. You may add any kind of caching technology via proper inheritance of Operations. As well as you may define super-class for, for example, networking operations, that would contain handling errors code, or reconnection policy.
- It is tested.
- It is opensource. You may take it, and rewrite for your own needs at any moment.
To add Chronos to your project simply add the following code to dependencies
section of your build.gradle
file:
compile 'com.redmadrobot:chronos:1.0.5'
Here is a quick four-step [guide] (https://github.com/RedMadRobot/Chronos/wiki/How-to-use-Chronos) that explains how you can integrate Chronos to your project.