@@ -13,18 +13,33 @@ dependencies {
13
13
14
14
## Basic usage
15
15
16
- GET:
17
-
18
- ``` java
19
- AsyncHttpClient cp = new AsyncHttpClient ();
20
- cp. get(" https://api.thecatapi.com/v1/images/search" , new TextHttpResponseHandler () {
21
- @Override
22
- public void onSuccess (int statusCode , Headers headers , String response ) {
23
- Log . d(" DEBUG" , response);
24
- }
25
-
26
- @Override
27
- public void onFailure (int statusCode , @Nullable Headers headers , String errorResponse , @Nullable Throwable throwable ) {
28
- }
29
- });
30
- ```
16
+ 1 . Please check to make sure all network calls are using ` https:// ` instead of ` http:// ` !
17
+
18
+ 2 . Verify that network access is allowed via the ` <uses-permission> ` :
19
+
20
+ ``` xml
21
+ <manifest xmlns : android =" http://schemas.android.com/apk/res/android"
22
+ package =" com.codepath.example" >
23
+
24
+ <uses-permission android : name =" android.permission.INTERNET" />```
25
+ ```
26
+
27
+ 3. Add API calls.
28
+
29
+ ```java
30
+
31
+ AsyncHttpClient client = new AsyncHttpClient();
32
+ client.get("https://api.thecatapi.com/v1/images/search", new TextHttpResponseHandler() {
33
+ @Override
34
+ public void onSuccess(int statusCode, Headers headers, String response) {
35
+ Log.d("DEBUG", response);
36
+ }
37
+
38
+ @Override
39
+ public void onFailure(int statusCode, @Nullable Headers headers, String errorResponse, @Nullable Throwable throwable) {
40
+ Log.d("DEBUG", errorResponse);
41
+ }
42
+ });
43
+ ```
44
+
45
+ See [ example calls] ( https://github.com/codepath/AsyncHttpClient/blob/master/example/src/main/java/com/codepath/example/TestActivity.java ) :
0 commit comments