Kotlin’s Coroutines allow the use of suspend functions, Channels and Flows and they all operate in the context of a so-called CoroutineScope. How can we tie it to the lifecycle management of our own components?

Coroutine Scope

If you are not at least somewhat familiar with what a CoroutineScope is, read this article by Roman Elizarov about Structured Concurrency first.

Lifecycle for Coroutines

A CoroutineScope defines a lifecycle, a lifetime, for Coroutines that are built and launched from it. A CoroutineScope lifecycle starts as soon as it is created and ends when it is canceled or when it associated Job or SupervisorJob finishes. …


In my earlier article, we examined how exceptions are handled by Coroutines and Coroutine Scopes that run with a Job, which is the default way of running them, without any so-called supervision.

Coroutines support Structured Concurrency, in which a parent-Coroutine that runs with a Job and its child-Coroutines all live and die together:

  1. A parent-Coroutine finishes only after all its child-Coroutines have finished.
  2. When a parent-Coroutine or scope finishes abnormally, either through cancelation or through an exception, all its child-Coroutines, that are still active, are canceled and new child-Coroutines can no longer be launched.
  3. When a child-Coroutine finishes abnormally, its…


Our code in Kotlin’s Coroutines may throw exceptions and managing them is not always as straightforward as we may think. Let’s examine the rules and offer some tips on how to deal with them.

“Kernel Panic” by Kevin Collins.

What is this blog post really about?

We started building our app, we chose Kotlin and we decided to use Coroutines as our main pattern to deal with asynchronous code. No regrets! And this article is not meant to convince us of this, or otherwise.

However… dealing with exceptions is a bit trickier than we expected. I myself tried to figure out some issues I had when dealing with exceptions thrown while launching…


LiveData and ViewModels from the Android Architecture Component library are building blocks of the reactive MVVM (Model-View-ViewModel) and MVI (Model-View-Intent) patterns when showing content in our app’s UI. But what about navigation? There are some issues we’d need to address and this article aims to help us with that.

What is the problem?

The problem revolves around the LiveData component. Whether we use the MVVM or MVI pattern, or some variant of them, our UI is reactive and it observes emitted values from one or more LiveData properties of a ViewModel. …


This is an overview of the functions let, also, apply, run and with in Kotlin and a guide to how you can use them.

Image of the exhibition of “5 Türen 2” by Gerhard Richter

This is not the first — and last — blog post on the Internet about the functions let, also, apply, run and with. They are part of the Kotlin standard library and developers use them often, and so do the developers in our company. With this blog post, I’ll be adding (yet another) guide on how to use them, and it is based on our experiences here at Intrepid.

Kotlin Receivers

Before continuing with the rest, let’s first…


What is symmetrical and asymmetrical encryption and how do browsers use it to protect your data?

When you open your browser and you see the text in the address-bar that begins with https, where the s stands for secured, you are sending and receiving information in a secure way. It is encrypted and only you and the website that you visit know what is being said.

Ever wondered how this all works?

There are two main parts to secure and encrypt information going back and forth. The first is a so-called handshake on how both parties should encrypt their data…

Anton Spaans

Principal Software Engineer at @intpd, part of @Accenture. You can find me online @streetsofboston or at https://www.linkedin.com/in/antonspaans/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store