Migrating AsyncTask to RxJava

Old code using AsyncTask

Let's assume we had an old MainActivity using an AsyncTask (which will be deprecated on API 30) to perform a long running operation.


Migrating it to RxJava

1. Setup

Add the libraries to the gradle dependencies.


2. Using the library

Copy/paste the snippet below into the MainActivity.kt file, ideally each class/interface would all have their own file, but we'll keep it in the same one for now to keep it simple.

Send us an email with any questions or suggestions!