What client engine is recommended for Android and ...
# ktor
m
What client engine is recommended for Android and why? And what Android versions support the CIO engine? There's conflicting information on that, here from a GitHub issue:
Unfortunately, the CIO engine supports only API level 24 or higher(Android >= 8.0)
API level 24 is Android 7 though 🤔
e
Hi @Marc Knaup. You could use
Android
,
OkHttp
or
CIO
based engines on your Android.
For WebSockets you could take
CIO
m
Yes I know about the three options but I'd like a way to decide for which one to use. If they are all almost the same then why two for Android in the first place? :) And I don't know what Android version I need for running CIO properly. And whether CIO has any benefits or downsides.
e
You need API level 24. CIO is fully on coroutines. Android and OkHttp use blocking network instead
m
Ah okay thank you. So Android 7 is fine, not Android 8 like it says on GitHub and here in Slack?
e
Yep
👍 1
r
@Marc Knaup unless that changed very recently,
CIO
also does not support HTTP/2
😢 1
👌 1
m
So I guess
Android
engine is most preferable for now as it supports HTTP/2 and doesn't require an additional library bundled with the app?
e
Android is based on
URLConnection
.
m
yes, so no external lib 🙂 There is no guidance on how to decide for an engine, so I need to collect information to be able to make that decision 🙂
r
Usually you use OkHttp over the vanilla Android thing because of its far better API and management of common network errors, but I don’t know how that applies to ktor as you’re behind the same API in this case. I don’t know what the other advantages of OkHttp are, but I’m pretty sure there are some
m
Yup, that's my problem - there's no information on stuff like that 😅