0

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.

Community
  • 1
  • 1
Sold Out
  • 1,321
  • 14
  • 34

1 Answers1

2

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491