Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Android Kotlin – Credential Manager sign in – coroutineScope

I’m trying to implement the new sign in method since the old one is what what ever the hell reason deprecated, but the google docs are as always incomplete.

This is the part I’m current at:

coroutineScope.launch {
    try {
        val result = credentialManager.getCredential(
            request = request,
            context = this,
        )
        handleSignIn(result)
    } catch (e: GetCredentialException) {
        handleFailure(e)
    }
}

coroutineScope is unresolved referrence

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’m watching this tutorial:
https://www.youtube.com/watch?v=P_jZMDmodG4

and the guy there just does:

val coroutineScope = rememberCoroutineScope()

and it works for him, but for me rememberCoroutineScope() is also unresolved referrence

How to make it work?

Thanks in advance

>Solution :

There are various ways to obtain a CoroutineScope, the most common being either in a suspend function and calling coroutineScope { ... } (or withContext and similar) or being in a @Composable function and calling rememberCoroutineScope().

The latter seems to be what was used in your example.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading