10

Kotlin Coroutines – Use Cases on Android

 3 years ago
source link: https://www.lukaslechner.com/kotlin-coroutines-use-cases-on-android/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Kotlin Coroutines – Use Cases on Android
HeaderImageCoroutinesUseCases.png?fit=1024%2C256&ssl=1

For the last couple of weeks, I worked really hard on a new open-source project called Kotlin Coroutines – Use Cases on Android. Today, I am really proud to present “Version 1.0” to you!

It currently consists of 16 self-contained implementations of common real-world use cases for using Coroutines on Android. These use cases are all about performing network requests sequentially and concurrently, using timeouts, performing retries, using Coroutines together with Room and WorkManager and performing expensive processing on background threads. It also has examples for “Cooperative Cancellation” and Exception Handling. You can find more information on the project readme. It also includes unit tests, of course 😉.

Screenshot_1587120560.png?fit=512%2C1024&ssl=1
MainActivity with a list of all the use cases

Motivation ⭐️

This is the project I wish I had when I started to learn Coroutines. It is easy to use (no setup like e.g. inserting API keys needed; just clone and run it) and easy to understand (simple architecture, self-contained implementations). If you are new to Coroutines, it will show you how to implement common Android use cases with Coroutines. You will learn them in an efficient and fun way.

But even if you already have experience with Coroutines, this repository can be a helpful companion for you. So whenever you face a tricky multithreading problem, this project is here to help you by either showing you examples similar to your problem or giving you a solid playground where you can try out your coroutine related logic very quickly.

Outlook 🔭

I also want to add use cases for the usage of Kotlin Coroutine – Channels and Flow in the future. Star the project or sign up to my newsletter in order to get information about major updates in the future.




📬 Get notified whenever I publish new content! 🚀

No Spam! Unsubscribe at any time!


Leave this field empty if you're human:

Feedback

If you have ideas for additional use cases or improvements, feel free to leave a comment or submit an issue or pull request!

I hope this project is helpful to you! Thanks for reading!

Share this Article!
b471eb2445c405a8d33f5777816550e3?s=100&d=mm&r=g

Lukas Lechner

I'm a Freelance Android Developer and Online Course Creator. I have many years of professional experience as an Android Developer and worked on some of the biggest mobile apps projects here in Austria. I like to write articles for my blog and speak at meetups and conferences.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK