Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
api/ | 03-May-2024 | - | 7 | 5 | ||
src/ | 03-May-2024 | - | 108 | 77 | ||
test/ | 03-May-2024 | - | 173 | 140 | ||
README.md | D | 03-May-2024 | 1,008 | 30 | 21 | |
build.gradle | D | 03-May-2024 | 1.2 KiB | 46 | 37 | |
package.list | D | 03-May-2024 | 28 | 1 | 1 |
README.md
1# Module kotlinx-coroutines-play-services 2 3Integration with Google Play Services [Tasks API](https://developers.google.com/android/guides/tasks). 4 5Extension functions: 6 7| **Name** | **Description** 8| -------- | --------------- 9| [Task.await][await] | Awaits for completion of the Task (cancellable) 10| [Deferred.asTask][asTask] | Converts a deferred value to a Task 11 12## Example 13 14Using Firebase APIs becomes simple: 15 16```kotlin 17FirebaseAuth.getInstance().signInAnonymously().await() 18val snapshot = try { 19 FirebaseFirestore.getInstance().document("users/$id").get().await() // Cancellable await 20} catch (e: FirebaseFirestoreException) { 21 // Handle exception 22 return@async 23} 24 25// Do stuff 26``` 27 28[await]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-play-services/kotlinx.coroutines.tasks/com.google.android.gms.tasks.-task/await.html 29[asTask]: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-play-services/kotlinx.coroutines.tasks/kotlinx.coroutines.-deferred/as-task.html 30