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
0 answers

Android image upload issue

I am developing an Android application for airport customer complain lodging and tracking.The user will enter their passenger ID,complain text and an image(optional)...i am using the Asynchronous Http Client library to upload the image to the…
0
votes
1 answer

LoopJ AndroidAsyncHttp is returning response in OnFailure

i am new to AndroidAsyncHttp. i created a class httptester : private static AsyncHttpClient client = new AsyncHttpClient(); public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) { …
Rashad.Z
  • 2,494
  • 2
  • 27
  • 58
0
votes
1 answer

Trying to get a json response from API web to Android with android-async-http lib

I've been working with android-async-http (http://loopj.com/android-async-http/) lib with android but for some reason I can't catch the response from server, I know that the server receive and do the things that should do, but I can't get the…
0
votes
0 answers

LoopJ AndroidAsyncHttp posting issue

I have to develope a simple chat application in android. I have to use MySQL as my backend database. But my problem is: When I am posting data on to the server, there may be too many post happends in my app. So that, duplicate records should be…
0
votes
1 answer

using loopj to download large data

I'm dealing with problems (memory leak, ui freeze, ...) using loopj (latest version: 1.4.6) to download some large (5m+) text data (complex json encoded objects which contain base64-encoded binary data as one of their fields). here's the base class…
magpie
  • 41
  • 1
  • 7
0
votes
1 answer

Android : How to do sync data automatically

In my application I will get large amount of data from the server. I want to sync all the data by automatically with the device. Even when my app is not in use, I want to sync the data. Right now I have done that by using AsyncTask. But it is taking…
0
votes
1 answer

LoopJ AndroidAsyncHttp download large file OOM

I need to download a large file from server using LoopJ AndroidAsyncHttp in a android app,but got a OOM for the file is to large. I have googled only to find that I need to write my own BinaryHttpResponseHandler and modify sendResponseMessage. But…
0
votes
1 answer

android Wear 5.0 can't resolve host (Http , AsyncClient ETC. )

I ve developed Android Wear App also SDK is 4.4AW. After finished that applitacion I tested on new android wear SDK that is 5.0.1 Emulator AND motorola360(with 5.0.1) then I recived this errror (Show in the below) Message Sum: can't resolve…
0
votes
2 answers

how to call REST API using asynch task one after the other

In one activity if i want to make 2-3 REST API calls one after the other as per below example. task1.execute(); /*calls API1*/ while(task1.getStatus().equals(AsyncTask.Status.FINISHED)){ task2.execute(); /*calls API2*/ }; …
bpetlur
  • 333
  • 5
  • 16
0
votes
1 answer

LoopJ AndroidAsyncHttp PUT, how to do?

I need some help correcting my approach for using the following API > https://github.com/Privo/PRIVO-Hub/wiki/Web-Services-API-Reference#update-user-display-name. I am unsure of how to send a JSON object for update using LoopJ AndroidAsyncHttp PUT.…
portfoliobuilder
  • 7,556
  • 14
  • 76
  • 136
0
votes
1 answer

Call a function in every onFailure block in AndroidAsyncHTTP

I'm using the android-async-http library in many locations in my app. My usual onFailure() block looks something like this: APIClient.POST("/user/login", params, new JsonHttpResponseHandler() { public void onSuccess(int statusCode, Header[]…
user4022746
0
votes
1 answer

How to send HTTP POST parameters using Android AsyncHttpClient?

I am trying the AsyncHttpClient library for Android and am trying to make a HTTP POST with it to my Express (NodeJS) server and I am having difficulties attaching parameters to the POST request. This is what I do: AsyncHttpClient httpClient = new…
zbr
  • 6,860
  • 4
  • 31
  • 43
0
votes
0 answers

cancelRequests(context, true) in Asynchronous Http Client is not working

I need to start and stop the Http request based on AsychronousHttpClient library. i can able to get start the request and getting data from the server but i cannot able to stop the request? Can Anyone suggest any ideas. This is my sample…
0
votes
2 answers

Will AsyncTask crash if I call it over 100 times in a loop?

I am getting a list of files from a web service and then using AsyncTask to handle the download of all files. Each task is created in a loop: for(int i = 0; i < arraySize; i++) { //Omitted all code except for the portion that fires the asynctask …
silversunhunter
  • 1,219
  • 2
  • 12
  • 32
0
votes
1 answer

Intent dependendent on 2 API calls?

Suppose I have a situation where an API response fills my Musician model with information specific to that musician. There is another API response that, given a musician name, describes related artists. I want to launch a detail activity showing…
HukeLau_DABA
  • 2,384
  • 6
  • 33
  • 51