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

260 questions
0
votes
1 answer

301 http response on uploading file from android AndroidAsyncHttp to django

can someone help me . tried to upload file from android using AndroidAsyncHttp api to django , but getting http exception "pemanently moved exception" 301 . this process worked locally but when uploading site to production it didnt work and the…
mcamocci
  • 56
  • 1
  • 4
0
votes
2 answers

java.lang.NoClassDefFoundError with AsyncHttpClient - API 19

There is many subject on stack regarding this, but none of them worked :/ I'm running android studio, i added this librarie in gradle, then gradle clean, built project and run app. Unfortunately each time i run the app it fail Process:…
RaccoonDeveloper
  • 224
  • 2
  • 11
0
votes
2 answers

AsyncHttpClient JSON onSuccess function is not getting executed

My application can't seem to run my onSuccess method. It says in the log: "W/JsonHttpRH: onSuccess(int, Header[], JSONArray) was not overriden, but callback was received" A lot of people use JSONArray instead of JSONObject, but this is not the case…
Mirwais
  • 131
  • 1
  • 4
  • 18
0
votes
1 answer

Android Postcodes.io HTTP Request

I'm using the AsyncHttpClient class and I can't save the result as a string within the OnSuccess function. Below is an example of the result I want to parse, I am trying to retrieve the "lsoa" value. { "status" : 200, "result" : { "postcode" :…
nope-d
  • 43
  • 1
  • 5
0
votes
1 answer

get android AsyncHttpClient response after it finish

hello i am using AsyncHttpClient to send request to restful api the problem is i want to have the result in onSuccess and pass it from the class who have this method to my activity public int send(JSONObject parameters,String email,String…
user6062547
0
votes
1 answer

Reverse proxified request return null in onSuccess in loopj.AsyncHttp

I have to use an restful API for my app in android, In this API we have to reverse proxy our app requests through our server( I use nginx proxy_pass for that), since the API only answers to one registered IP. When I use curl to send a request…
FazeL
  • 916
  • 2
  • 13
  • 30
0
votes
2 answers

Read Params Passed From android-async-http to JAX-RS

Question is below in bold. I have a PUT method in my jax-rs which is the following code: @PUT @Path("{id}/url.json") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public ResponseEntity dealRedeemed(@PathParam("id") long id, …
Bhavik P.
  • 905
  • 3
  • 10
  • 28
0
votes
1 answer

AsyncHttpClient - POST request over HTTPS

I'm developing a new Android app which allow the user to rate the content. The rate is sent thanks to an asynchronous request (POST) over HTTPS. Unfortunately, the request don't reach my webservice. When I took a look at the log access log, the URL…
Schnapse
  • 485
  • 1
  • 5
  • 19
0
votes
1 answer

get image from server and set into imageview using async http response handler

My question is how to fetch an image from server and set into imageview using Async Http Response Handler. The JsonObject for image is "profile_image" which needs to be fetched from the Rest api and display into my ImageView. My…
nikita Yalgi
  • 37
  • 1
  • 1
  • 7
0
votes
1 answer

Why the Http Post in my android application gets Timeout exception when the device is connected via 3G?

In my Android application I run a http post and I get timeout exception when i am connected via 3G/4G and not via wifi (I send images but this happened with images of 1 Kb as well, the problem it's not the size of image, I am sure about this). Here…
alfo888_ibg
  • 1,847
  • 5
  • 25
  • 43
0
votes
1 answer

AndroidHttpAsync not working at oncreate method

Whenever I use AsyncHttpClient in onCreate(Bundle savedInstanceState), onSuccess() method never used. I put a break point, than debug... Never visit to break point if the break point is in the onSuccess() method, but when I put a button, after…
0
votes
2 answers

How to use AsyncHttpClient post request with loopj library on using Token Based Authentication

I am using Token Based Authentication on my project to control login authentication. My Token Based Authentication requires: Header: Accept Value: application/json Header: Content-Type Value:…
0
votes
1 answer

How to request in roads api using snap to roads?

i would like to use the roads api to get the distance of my currentlocation and add the list of Latlng in onLocationChanged and to snap a set of coordinates (approx 100~200 points) to roads and that will return a json to get the accurate distance of…
0
votes
0 answers

How to do multiple API requests with Android-Async-Http?

in my app i have to call an API for about 20 times after an the activity starts. There is no posibility to get all the data in one call. At the moment im using Android-Async-Http for only one call like this and it works well: client = new…
midi
  • 3,128
  • 5
  • 30
  • 47
0
votes
1 answer

how should i send a binary file to sdcard such as image or .apk

I use 'com.loopj.android:android-async-http:1.4.9' to make a http request.I use BinaryHttpResponseHandler to get a image , but i want to send it to sdcard. My code is: AsyncHttpUtils.getBinary(url, new BinaryHttpResponseHandler(allowedContentTypes)…
PPTing
  • 150
  • 1
  • 1
  • 12