How to connect to Android network, HTTP library preferences?

I find at least 3 different ways to send an HTTP request from an Android application.

It:

Which should I use for an application that wants to get JSON server database results for later analysis? Is anyone faster? What are the advantages of each of them? Thanks in advance!

+4
source share
5 answers

My advice is to use the Android option. Android developers have done such things to try to simplify tasks that would normally be more difficult than necessary if you used the Apache and Java options. This is what I will do. If you like something else more, can you always try it? It's up to you though. Only my two cents.

0
source

You must use the HttpUrlConnection. The android team plans to support it in the future. But don't think about it: http://android-developers.blogspot.com/2011/09/androids-http-clients.html

+3
source

I would suggest using HttpURLConnection for a simple resource grab.

This class is very versatile and can handle HTTPS, HTTP Authentication, POSTing, cookies, and a number of other useful properties for HTTP calls. The Android developer documentation for the HttpURLConnections links above provides some good examples of how to use the class correctly.

+2
source

You can also try this library: http://moazzam-khan.com/blog/?p=490

0
source

If you need support for websocket and async, then a good choice is also:

https://github.com/AsyncHttpClient/async-http-client

0
source

All Articles