Home > Software design >  Is retrofit post data to api in background thread automatically
Is retrofit post data to api in background thread automatically

Time:12-03

Hi all I have question is retrofit post data to api in background thread automatically or should I use something like RXjava to make it?

CodePudding user response:

Retrofit by default doesn't run network requests on main thread (if thats what you need to know), so you don't really need to do anything in that regard.

but if you are using Kotlin, i would highly suggest you to use Retrofit with Coroutines, which is not mandatory for kotlin applications but it is more efficient and is built in kotlin itself so you don't need to install any third party lib.

here is a useful guide on how to use Retrofit with Coroutines: link

  • Related