Sold Out
Sold Out

Reputation: 1428

Do new libraries work with older android devices?

I am trying to build an android app, exchanging data with a PHP server via JSON. Thus I need to learn working with GSON, org.apache.http.* libraries - so called

apache library module

.

I've studied several examples that use lib classes like HttpClient, HttpEntity, HttpResponse and the like. When I try to add similar code into my app, I get a warning that virtually all library classes with Http* prefix are deprecated.

I have learned that Android team has deprecated apache module since API 22+

There are sevaral threads suggesting to use URLConnection instead. Like this one.

My question is: Will my app work on older android devices (android 2.0.x - 4.4), if I'd follow the advice to use URLConnection ? I build on AndroidStudio 2.1.2 / Gradle.

If there is even better option than URLConnection, your hint will be appreciated. No proprietary libraries, please. I prefer standard stuff.

Upvotes: 0

Views: 31

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006704

Will my app work on older android devices (android 2.0.x - 4.4), if I'd follow the advice to use URLConnection ?

HttpURLConnection is not recommended prior to Android 2.2 due to bugs. Since few devices run such Android versions, this should not be a major impediment. Otherwise, HttpURLConnection works fine, though its API leaves something to be desired. Personally, I recommend OkHttp3.

Upvotes: 2

Related Questions