I am using volley library my volley request is working perfect in nougat, oreo, marshmallow OS but its not working in lollipop device it give error server error I handled the error and I found error is 400 Bad request I am sharing error screenshot and also sharing my code please help me my api is also work in postman...
MY Request Code Is:
private void proceedToCheakOut(){ String tag_string_req = "req_check_out_data"; String uri = AppConfig.URL_CHECK_OUT + "?userid=" + preferences.getString(SharedPref.KEY_USER_ID, "") + "&hotelid=" + preferences.getString(SharedPref.KEY_HOTEL_ID,"") + "&band=" + preferences.getString(SharedPref.KEY_BAND_ID, "") + "&area=" + preferences.getString(SharedPref.KEY_SEARCH_AREA, "") + "&check_in=" + preferences.getString(SharedPref.KEY_CHECK_IN, "") + "&check_out=" + preferences.getString(SharedPref.KEY_CHECK_OUT, "") + "&room=" + preferences.getString(SharedPref.KEY_ROOM, "") + "&adult=" + preferences.getString(SharedPref.KEY_ADULT, "") + "&above=" + preferences.getString(SharedPref.KEY_ABOVE_8, "") + "&below=" + preferences.getString(SharedPref.KEY_BELOW_8, "") + "&spouse=" + preferences.getString(SharedPref.KEY_SPOUSE, "") + "&days=" + preferences.getString(SharedPref.KEY_NO_OF_DAYS, "") + "&roomid=" + preferences.getString(SharedPref.KEY_ROOM_ID, "") + "&" + SharedPref.KEY_DEFENCE_ID + "=" + preferences.getString(SharedPref.KEY_DEFENCE_ID, "") + "&spousePrice=" + spousePrice + "&adultPrice=" + adultPrice + "&abovePrice=" + abovePrice + "&belowPrice=" + belowPrice + "&price=" + price + "&tax=" + tax + "&grandTotal=" + grandTotal + "&userName=" + adult1Data + "&userRank=" + RankData + "&adultList=" + adultsArray + "&aboveList=" + childaboveArray + "&belowList=" + childbelowArray; Log.e("URI", uri); StringRequest strReq = new StringRequest(Request.Method.GET, uri, new Response.Listener() { @Override public void onResponse(String response) { try { JSONObject jObj = new JSONObject(response); boolean error = jObj.getBoolean("error"); // Check for error node in json if (!error) { Toast.makeText(CheckoutPersonalDetailActivity.this, "Booking Successful", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(CheckoutPersonalDetailActivity.this, BookingDoneActivity.class); intent.putExtra("grandTotal", grandTotal); intent.putExtra(SharedPref.KEY_BOOKING_ID, jObj.getString("bookingid")); intent.putExtra(SharedPref.KEY_BOOKING_DATE, jObj.getString("bookingdate")); intent.putExtra(SharedPref.KEY_BOOKING_STATUS, jObj.getString("bookingstatus")); intent.putExtra("reminderhour", jObj.getString("reminderhour")); intent.putExtra("HotelImageString", hotelImgString); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); String title = "Booking Pending"; String description = "Booking is Pending, Your Booking Id is: "+ jObj.getString("bookingid"); sendNotification(title, description, jObj.getString("bookingid")); } else { Toast.makeText(CheckoutPersonalDetailActivity.this,jObj.getString("error_msg"), Toast.LENGTH_LONG).show(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if (error == null || error.networkResponse == null) { return; } String body; //get status code here final String statusCode = String.valueOf(error.networkResponse.statusCode); try { body = new String(error.networkResponse.data,"UTF-8"); Toast.makeText(CheckoutPersonalDetailActivity.this, "Error: "+body, Toast.LENGTH_LONG).show(); } catch (UnsupportedEncodingException e) { // exception } } }); // Adding request to request queue AppController.getInstance().addToRequestQueue(strReq, tag_string_req); }