Java Code Examples for com.loopj.android.http.AsyncHttpResponseHandler#onFailure()
The following examples show how to use
com.loopj.android.http.AsyncHttpResponseHandler#onFailure() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DevicesApi.java From freeiot-android with MIT License | 6 votes |
/** * set device status (/v1/devices/{identifier}/status) * @param context * @param accessToken * @param identifier * @param responseHandler */ public static void setDeviceCurrentState(Context context, String accessToken, String identifier,String jsonBody, AsyncHttpResponseHandler responseHandler) { List<Header> headerList = new ArrayList<Header>(); headerList.add(new BasicHeader(ApiKey.HeadKey.ACCESS_TOKEN, accessToken)); try { put(context, String.format(getApiServerUrl() + DEVICE_SET_CURRENT_STATUS, identifier), headerList, jsonBody, responseHandler); } catch (Exception e) { e.printStackTrace(); responseHandler.onFailure(INNER_ERROR_CODE, null, null, e); } }
Example 2
Source File: DevicesApi.java From freeiot-android with MIT License | 5 votes |
/** * device unbinding (/v1/devices/{identifier}/unbinding) * @param context * @param accessToken * @param responseHandler */ public static void deviceUnbinding(Context context, String accessToken, String identifier, AsyncHttpResponseHandler responseHandler) { List<Header> headerList = new ArrayList<Header>(); headerList.add(new BasicHeader(ApiKey.HeadKey.ACCESS_TOKEN, accessToken)); try { post(context, String.format(getApiServerUrl() + DEVICE_UNBINDING, identifier), headerList, null, responseHandler); } catch (UnsupportedEncodingException e) { e.printStackTrace(); responseHandler.onFailure(INNER_ERROR_CODE, null, null, e); } }
Example 3
Source File: UserApi.java From freeiot-android with MIT License | 5 votes |
/** * user logout (/v1/users/logout) * @param context * @param accessToken * @param responseHandler */ public static void logout(Context context, String accessToken, AsyncHttpResponseHandler responseHandler) { List<Header> headerList = new ArrayList<Header>(); headerList.add(new BasicHeader(ApiKey.HeadKey.ACCESS_TOKEN, accessToken)); try { post(context, getApiServerUrl() + USER_LOGOUT, headerList, null, responseHandler); } catch (UnsupportedEncodingException e) { e.printStackTrace(); responseHandler.onFailure(INNER_ERROR_CODE, null, null, e); } }