<How to call async/await method without using Glob...
# stackoverflow
u
How to call async/await method without using GlobalScope.launch{} in Kotlin I am trying to use async/await in kotlin to make calls to an api. I already created the method and it works! but now I don't know how to call it in an activity or in a viewmodel WITHOUT using GlobalScope.launch {} ?? There is another way ? class Service{ var client: OkHttpClient = OkHttpClient(); fun getRequest(sUrl: String) =GlobalScope.async { Thread.sleep(2000) var result: String? = null try { // Create URL val url = URL(sUrl)...