https://kotlinlang.org logo
#ktor
Title
# ktor
m

Marc Knaup

02/28/2019, 11:32 PM
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

e5l

03/01/2019, 5:24 AM
Hi @Marc Knaup. You could use
Android
,
OkHttp
or
CIO
based engines on your Android.
For WebSockets you could take
CIO
m

Marc Knaup

03/01/2019, 9:23 AM
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

e5l

03/01/2019, 9:24 AM
You need API level 24. CIO is fully on coroutines. Android and OkHttp use blocking network instead
m

Marc Knaup

03/01/2019, 9:24 AM
Ah okay thank you. So Android 7 is fine, not Android 8 like it says on GitHub and here in Slack?
e

e5l

03/01/2019, 9:27 AM
Yep
👍 1
r

ribesg

03/01/2019, 10:32 AM
@Marc Knaup unless that changed very recently,
CIO
also does not support HTTP/2
😢 1
👌 1
m

Marc Knaup

03/01/2019, 10:42 AM
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

e5l

03/01/2019, 10:42 AM
Android is based on
URLConnection
.
m

Marc Knaup

03/01/2019, 10:43 AM
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

ribesg

03/01/2019, 10:45 AM
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

Marc Knaup

03/01/2019, 10:46 AM
Yup, that's my problem - there's no information on stuff like that 😅
3 Views