2

I know, there are much posts and answers on this topic and it seems, I have read them all... But I just want to know how to do an easy https request in my Android app. Is there a easy class which make such an request? I want to call something like

String response = new EasyHttpRequest().execute(myUrl).get();

in my MainActivity

For information I can't just set the response Text to an TextView in the onPostExecute() method, I have to work with this data and save it or something else.

Cœur
  • 37,241
  • 25
  • 195
  • 267
JonasPTFL
  • 189
  • 4
  • 15

2 Answers2

1

The best library I know so far for network requests is Retrofit. It's kind of a standard for Android apps. If you want something more low level you can use Okhttp.

Both libraries can work together, and they are more than production ready. Of course, they support https and many other security features as ssl certificate pinning.

They support running the request on the same thread you are or in a background queue provided by the library, up to you if then you want to wrap it on an asyncTask, simple thread or service, those libraries leave you some freedom in that matter.

droidpl
  • 5,872
  • 4
  • 35
  • 47
0

You can use this repo . it's very easy to use. okhttp-utils

morteza jafari
  • 270
  • 2
  • 12