Fabii Fabii - 9 months ago 32
Android Question

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

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 turn validates the parameters and sends back a response.

I've look through implementations using HttpClient and URLConnection, they are very similar.Which is more efficient for utilization within an android app?

Thanks
Fabii

Answer Source

I believe in this case it's up to whichever API you find more natural. Generally, HTTPClient is more efficient inside a server side application (or maybe batch application), because it allows you to specify a multithreaded connection pool, with a max number of total connections, and a max per host connection count (which ensures concurrent connections to the same host don't get serialized (a problem with HttpUrlConnection)). But in an android app, you'll probably only be making a single connection at a time, so this doesn't matter.