Skip to content

Files

Latest commit

6f01c93 · Oct 24, 2018

History

History
This branch is 1776 commits behind Kotlin/kotlinx.coroutines:master.

kotlinx-coroutines-play-services

Module kotlinx-coroutines-play-services

Integration with Google Play Services Tasks API.

Extension functions:

Name Description
Task.await Awaits for completion of the Task (cancellable)
Deferred.asTask Converts a deferred value to a Task

Example

Using Firebase APIs becomes simple:

FirebaseAuth.getInstance().signInAnonymously().await()
val snapshot = try {
    FirebaseFirestore.getInstance().document("users/$id").get().await() // Cancellable await
} catch (e: FirebaseFirestoreException) {
    // Handle exception
    return@async
}

// Do stuff