Skip to content

Instantly share code, notes, and snippets.

View janishar's full-sized avatar
:octocat:
Enthusiastically Curious

Janishar Ali janishar

:octocat:
Enthusiastically Curious
View GitHub Profile
@RohitSurwase
RohitSurwase / CoroutineIntentService.kt
Last active May 22, 2024 22:54
IntentService (Service) using Kotlin Coroutines instead of Handler+Looper.
import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.support.annotation.Nullable
import android.support.annotation.WorkerThread
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.channels.actor
import kotlin.coroutines.CoroutineContext