In my app i have used Looj library (AsynHttpClient) to get response from the server its working fine with http link on android 5.0 but when i changed link to https then its only working on android 7.0 and newer versions. Even i have tried to log the issues on android 5.0 but onSuccess and onFailure methods also not get call in android 5.0. App is working perfectly on android 7.0 and newer versions of android. Below is my login function please have a look.

public static void funLogin(final String userName, final String password, final ResponseListener listener) {

    client.removeAllHeaders();
    client.addHeader("Username", userName);
    client.addHeader("Password", password);
    client.addHeader("AuthToken", AUTH_TOKEN);
    client.addHeader("DeviceID",CommonUtils.fireBaseDeviceID);

    client.get(BASE_URL + LOGIN, new JsonHttpResponseHandler() {

        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
            super.onSuccess(statusCode, headers, response);


            try {
                jsonArray=response.getJSONArray("UserDetail");
               CommonUtils.userDetailBeans.add(new Gson().fromJson(jsonArray.get(0).toString(), UserInfoModel.UserDetailBean.class));
                //listener.onSuccess(response.getString("MessageToShow"));
                listener.onSuccess(response.getJSONArray("UserDetail").toString());
            } catch (JSONException e) {
                e.printStackTrace();

            }
            Log.i("response",response.toString());
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
            super.onFailure(statusCode, headers, responseString, throwable);

            listener.onFailure(responseString);
        }
    });

}

App needs to work also on Android kitkat,Loolipop and Mashmallow.

0 Answers