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

Get JSON response containing Github user list using AsyncHttpClient

I'm trying to get response with user json list from github api. Could anyone tell me the reason why code execution path doesn't reach overriden methods onFailure() and onSuccess? public String getResponse() { AsyncHttpClient client=new…
AnZyuZya
  • 201
  • 1
  • 3
  • 18
0
votes
1 answer

Android Apache HttpClient calls response interceptor with incorrect HttpContext

I'm using "com.loopj.android:android-async-http:1.4.5" in my Android app. The setup is that there is one instance of the below HttpDataSource class per API endpoint (eg: http://myhost.com/some/service/{pathParam}); thus there are multiple instances…
kierans
  • 2,034
  • 1
  • 16
  • 43
0
votes
2 answers

Android app crashes when initializing AndroidAsyncHttp

As I understood (from here) the LoopJ AndroidAsyncHttp does not uses the UI Thread, therefore i can execute its methods in the Main Thread. but when i intilize a new instance of AsyncHttpClient the app crashes (exception:…
Gil
  • 97
  • 2
  • 10
0
votes
0 answers

android AysncHttpRequestClient cancel request when switching tabs

Hi i am using AsyncHttpRequestClient to run my network calls which i'm calling from a fragment and a tab bar. when the tab switches to a new fragment i need to cancel any requests that may have been running on the previous fragment. Normally i would…
iamlukeyb
  • 6,487
  • 12
  • 29
  • 40
0
votes
2 answers

best way to wait until load data from different request android

I have to load data in the same activity, from different request request 1 will load some data and request 2 will load data from another url now I am calling them sequential request1.run () request2.run () the problem now that i need to show dialog…
Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175
0
votes
2 answers

Error : org.apache.http.client.HttpResponseException: Unsupported Media Type

I am trying to call web api using http://loopj.com/android-async-http/ & using POST method. I am sending json & content type in my code that's always gives error message. org.apache.http.client.HttpResponseException: Unsupported Media Type When I…
N Sharma
  • 33,489
  • 95
  • 256
  • 444
0
votes
1 answer

android-asycn-http: Never send the http request

I'm using android-async-http 1.4.5, but I found it never calls my server, here's my code : public class HttpUtils { private static AsyncHttpClient client = new AsyncHttpClient(); public static void get(String url, RequestParams params,…
WoooHaaaa
  • 19,732
  • 32
  • 90
  • 138
0
votes
1 answer

Get and parse JSP page on Android

I am trying to create an Android App to display my school agenda. I'm doing it fine at the beginning with loopj. I can connect to my school account and get pages. BUT, the agenda part is a JSP page and i'm entering into "onFailure" method. I'm using…
maxime1992
  • 22,502
  • 10
  • 80
  • 121
0
votes
1 answer

jsonHttpResponseHandler callbacks aren't invoked

I am making a GET request to: http://www.opensecrets.org/api/?method=getLegislators&apikey=xxx&output=json&id=ny using android asynchttp 1.4.3. I set multiple breakpoints, but no exception is thrown and none of the following callbacks are being…
HukeLau_DABA
  • 2,384
  • 6
  • 33
  • 51
0
votes
2 answers

Creating a jsonObject that contains another jsonObject

I am using asynchttpclient to do a POST and am constructing a body like this: { "params": { "firstname": "%Paul%" } } The following sometimes produces the right body, sometimes produces an empty body: String…
HukeLau_DABA
  • 2,384
  • 6
  • 33
  • 51
0
votes
0 answers

LoopJ AndroidAsyncHttp Library: Server Recieves Null Parameters

I am using the LoopJ AndroidAsyncHttp Library in an Android Project but when I try to get the parameters at the server side, I get null. I tried using PHP & Java same result. I am 100% sure my server side is working since I use postman chrome plugin…
0
votes
1 answer

LoopJ AndroidAsyncHttp Server Response after POST Android

I am using LoopJ AndroidAsyncHttp to get/post data from/to my server. I know that when I call the .get method, the JSON response is stored in the s string as shown below: client = new AsyncHttpClient(); …
user3794585
  • 203
  • 1
  • 11
0
votes
2 answers

Passing Array to Asynch Task

I can pass a string value to Asynctask, but i am unable to pass the array. Can anyone please inform me, how can i do this ? And I am want to pass that array to the server (//printwriter.write(messsages); ) ...HOW CAN I PASS THIS ? { String[]…
user3739443
  • 71
  • 1
  • 1
  • 3
0
votes
1 answer

How could i dynamically pass the following data as json to asyncHTTPClient?

{     "Name”: ”ValidateUserName”,     “Message”: {         ”UserName”: ”p”     } } How could i make these parameters to json format to dynamically pass the parameters to AsyncHTTPClient post method. Using below method gives a wrong…
SMS
  • 558
  • 1
  • 9
  • 22
0
votes
0 answers

AsyncHttpClient fails always with internal server error

I am a starter on Android platform,i just doing a porting of iOS app to Android.In iOS i used AFNetworking to access the web service .Same thing in Android i am using AsyncHttpClient and trying to communicate with the server (text json data…
SMS
  • 558
  • 1
  • 9
  • 22