URLConnection or HTTPClient : Which offers better functionality and more efficiency?

后端 未结 6 2005
臣服心动
臣服心动 2020-11-27 18:45

I looking to create a login form for an android application. I want to use a post method to send information to the server side where it is handle by a PHP file; which in tu

6条回答
  •  情歌与酒
    2020-11-27 19:08

    I have done a bit of research over this, I have been using Apache HttpClient for a long time in Android. It looked a natural choice to me and thought that it will be improved over time.

    On the other side while I was developing for legacy BlackBerryOS, I have been using HttpUrlConnection.

    It was clearly evident to me that the performance of BB was better than Android in context of networking.

    HttpClient is a fully functional but buggy class that provides a huge set of APIs/methods. It can be used to create a fully functional WebBrowser for Android. But it has some issues on older version of Android and its not actively being contributed to by Google.

    Whereas HttpUrlConnection has a pretty useful API that is just useful to develop a networking client application. It has improved response caching and improved compression technique on Android 2.3 and above. It is recommenced when you are building a networking client application.

    "Apache HTTPClient has fewer bugs on Eclair and Froyo. It is the best choice for these releases.

    For Gingerbread and better, HttpURLConnection is the best choice. Its simple API and small size makes it great fit for Android. Transparent compression and response caching reduce network use, improve speed and save battery. New applications should use HttpURLConnection; it is where Google will be spending its energy going forward."

    Refer for details

    http://android-developers.blogspot.in/2011/09/androids-http-clients.html

提交回复
热议问题