Questions tagged [android-async-http]

A Callback-Based Http Client Library for Android.

Overview

An asynchronous callback-based Http client for Android built on top of Apache’s HttpClient libraries. All requests are made outside of your app’s main UI thread, but any callback logic will be executed on the same thread as the callback was created using Android’s Handler message passing. You can also use it in Service or background thread, library will automatically recognize in which context is ran.

Features

  • Using upstream HttpClient of version 4.3.6 instead of Android provided DefaultHttpClient
  • Compatible with Android API 23 and higher
  • Make asynchronous HTTP requests, handle responses in anonymous callbacks
  • HTTP requests happen outside the UI thread
  • Requests use a threadpool to cap concurrent resource usage
  • GET/POST params builder (RequestParams)
  • Multipart file uploads with no additional third party libraries
  • Streamed JSON uploads with no additional libraries
  • Handling circular and relative redirects
  • Tiny size overhead to your application, only 90kb for everything
  • Automatic smart request retries optimized for spotty mobile connections
  • Automatic gzip response decoding support for super-fast requests
  • Binary protocol communication with BinaryHttpResponseHandler
  • Built-in response parsing into JSON with JsonHttpResponseHandler
  • Saving response directly into file with FileAsyncHttpResponseHandler
  • Persistent cookie store, saves cookies into your app’s SharedPreferences
  • Integration with Jackson JSON, Gson or other JSON (de)serializing libraries with BaseJsonHttpResponseHandler
  • Support for SAX parser with SaxAsyncHttpResponseHandler
  • Support for languages and content encodings, not just UTF-8

Library Link & More Information About Setup

Repo

loopj - James Smith

262 questions
47
votes
9 answers

POSTing JSON/XML using android-async-http (loopj)

I am using android-async-http and really liking it. I've run into a problem with POSTing data. I have to post data to the API in the following format: - Test api support 3
Mus
  • 1,840
  • 2
  • 16
  • 19
11
votes
3 answers

Google Volley vs Android-Async-Http

I am looking into both these Android Http Networking libraries. I would like some peoples experiences with using the two libraries. Personally I have always used the http://loopj.com/android-async-http/ library quite happily. But it was recently…
Zapnologica
  • 20,003
  • 39
  • 136
  • 229
9
votes
1 answer

Send JSON as a POST request to server by AsyncHttpClient

I want to send JSON as a POST to my localhost server with LoopJ's AsndroidAsyncHttpt. I'm using this method: public void post(Context context, String url, HttpEntity entity, String contentType, AsyncHttpResponseHandler responseHandler) in my code…
user3448282
  • 2,143
  • 2
  • 20
  • 41
8
votes
2 answers

LoopJ AndroidAsyncHttp and JSON POST ARRAY

I was using LoopJ AndroidAsyncHttp library to comunicate with my PhP Server. And i got a problem. I need to send a JsonObject like that: { "data": 2376845, "data2": 12545, "array": [{"data3": "2013-01-10", …
DoberDog
  • 502
  • 2
  • 10
  • 26
7
votes
1 answer

Difference between RequestParams add() and put() in AndroidAsyncHttp

While using the android-async-http library I stumbled upon params.add(). I've been using params.put() for a while and it seems better than add() since it allows data types other than String (like int, long, object, file) while add() does…
user4022746
7
votes
4 answers

how to make HTTPS calls using AsyncHttpClient?

i was using AsyncHttpClient link for making http calls but now our server has migrated to HTTPS and I am getting exception javax.net.ssl.SSLPeerUnverifiedException: No peer certificate . Has anyone tried making https call using this library…
r4jiv007
  • 2,285
  • 3
  • 26
  • 34
7
votes
3 answers

Dowloading image resources from https with LoopJ AndroidAsyncHttp

I'm using LoopJ AndroidAsyncHttp to download images but when I try it for HTTPS URLs I get no response. Code: AsyncHttpClient client = new AsyncHttpClient(); client.get(httpsUrlString, new BinaryHttpResponseHandler(allowedContentTypes) { …
luigi23
  • 295
  • 2
  • 9
7
votes
5 answers

How to upload multiple files with AsyncHttpClient Android

I know I can upload single file from AsyncHttpClient http://loopj.com/android-async-http/ File myFile = new File("/path/to/file.png"); RequestParams params = new RequestParams(); try { params.put("profile_picture", myFile); }…
Yogesh Maheshwari
  • 1,294
  • 2
  • 15
  • 36
6
votes
1 answer

Sugar ORM is not saving data into the database

I am currently using Sugar ORM and Android Async Http Client for my Android application. I read through the documentation of Sugar ORM and did exactly what is written there. My HttpClient is using the singleton pattern and provides methods for…
Mehrad Rafigh
  • 156
  • 5
  • 20
5
votes
2 answers

IllegalStateException when trying to show dialog fragment

I get IllegalStateException on Google-Play Console which I can not reproduce and I don't understand what is the issue. Here is the log from Google-Play Console java.lang.RuntimeException: at…
5
votes
3 answers

IOException when using loopj SyncHttpClient

I have the need to use loopj's SyncHttpClient in a couple areas. When I use AsyncHttpClient, the request returns successfully. When I use the SyncHttpClient as shown in the accepted answer here: How to use loopJ SyncHttpClient for synchronous…
mikeorr85
  • 451
  • 4
  • 12
5
votes
8 answers

Is it good practice to develop a helper network class that is responsible for all network tasks?

I have created the following class: public class AsyncHttpsClientHelper { public static final int REMOVE_CREDIT_CARD = 1; public static final int ENABLE_AUTORENEW = 2; // +10 final ints... private static AsyncHttpsClientHelper instance =…
Emil Adz
  • 38,699
  • 35
  • 127
  • 177
5
votes
1 answer

LoopJ AndroidAsyncHttp and request cookies

Regarding to LoopJ AndroidAsyncHttp examples I make a get request like this: final TextView text = (TextView) findViewById(R.id.textView); AsyncHttpClient client = new AsyncHttpClient(); client.get("http://example.com/mypage/", new…
trante
  • 30,976
  • 45
  • 174
  • 260
5
votes
1 answer

asyncHttpClient no onSuccess or onFailure run

I'm trying to connect means AsyncHttpClient to a php script on my website. The script do the html parsing of another page, and convert the result to json. it work well. But, when I try to take the json form java for using it on android, the method…
Marino
  • 577
  • 9
  • 22
4
votes
1 answer

android-async-http uploading image to php server

I've been looking all day about how to upload image from my application to server side. I've done the mobile application side public static void postImage(String ImageLink){ RequestParams params = new RequestParams(); …
Khalil Rumman
  • 537
  • 1
  • 6
  • 22
1
2 3
17 18