Skip to content

Commit eb3194f

Browse files
authored
Update README.md
1 parent 9562e8e commit eb3194f

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
# AsyncHttpClient library
22

3-
Lightweight async HTTP client based on [OkHttp](https://square.github.io/okhttp/). It tries to follow a similar API inspired by this [library](https://github.com/android-async-http/android-async-http)
3+
This is a lightweight asynchronous HTTP client powered by [OkHttp](https://square.github.io/okhttp/) but with a significantly simplified and easier to use API design.
44

5+
The goal of this library is to have an API that clearly and cleanly supports the following features:
6+
7+
* Asynchronous network requests without any need for manual thread handling
8+
* Response `onSuccess` callbacks run on the mainthread (by default)
9+
* Easy way to catch all errors and failures and handle them
10+
* Easy pluggable Text, JSON, and Bitmap response handlers to parse the response
11+
12+
This client tries to follow a similar API inspired by this [older now deprecated android-async-http library](https://github.com/android-async-http/android-async-http).
513

614
## Setup
715

16+
To use this library, add the following to your `.gradle` file:
17+
818
```gradle
919
dependencies {
1020
implementation 'com.codepath.libraries:asynchttpclient:0.0.8'
@@ -13,7 +23,7 @@ dependencies {
1323

1424
## Basic usage
1525

16-
1. Please check to make sure all network calls are using `https://` instead of `http://`!
26+
1. Make sure all network calls are using `https://` instead of `http://`
1727

1828
2. Verify that network access is allowed via the `<uses-permission>`:
1929

@@ -24,10 +34,9 @@ dependencies {
2434
<uses-permission android:name="android.permission.INTERNET" />```
2535
```
2636

27-
3. Add API calls.
37+
3. Add any networking calls by leveraging the `AsyncHttpClient`
2838

2939
```java
30-
3140
AsyncHttpClient client = new AsyncHttpClient();
3241
client.get("https://api.thecatapi.com/v1/images/search", new TextHttpResponseHandler() {
3342
@Override
@@ -42,4 +51,8 @@ dependencies {
4251
});
4352
```
4453

45-
See [example calls](https://github.com/codepath/AsyncHttpClient/blob/master/example/src/main/java/com/codepath/example/TestActivity.java)
54+
This example uses `TextHttpResponseHandler` which presents the response as raw text. We could use the `JsonHttpResponseHandler` instead to have the API response automatically parsed for us into JSON. See [other example calls here](https://github.com/codepath/AsyncHttpClient/blob/master/example/src/main/java/com/codepath/example/TestActivity.java).
55+
56+
## More documentation
57+
58+
For a more detailed usage, check out the [CodePath Async Http Client Guide](https://guides.codepath.com/android/Using-CodePath-Async-Http-Client)

0 commit comments

Comments
 (0)