I am trying to add files to google drive using kotlin in cororutines but getting error that main thread will be blocked even if i am using coroutine

215 views Asked by At

Here is the issue I am making the file and then adding to google drive but it says inappropriate blocking method call. enter image description here

1

There are 1 answers

0
Sina Dalvand On BEST ANSWER

You should run long running task in another Thread or use Coroutine to execute blocking method.

by using Coroutine it will be sth like this:

    withContext(Dispatchers.IO) {
        launch{
          mfile.execute();
        }
    }