2

I am developing android application where volley library working fine on some devices whereas on other device it is returing 406 exception for same request.

Postman also returning proper result with same request.

   public void doPostOperation()
    {

        IOUtils.startLoadingPleaseWait(mContext);
        JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, requestUrl, jsonRequest, listenerSuccess, listenerError)
        {

            @Override
            public Map<String, String> getHeaders() throws AuthFailureError
            {

                Map<String, String> headers = new HashMap<String, String>();
                headers.put("Cookie", Preference.getInstance(mContext).getData(Constants.Cookie));
                headers.put("X-CSRF-Token", Preference.getInstance(mContext).getData(Constants.Token));
                return headers;
            }
        };
        request.setRetryPolicy(new DefaultRetryPolicy(60 * 1000, 1, 1.0f));
        app.addToRequestQueue(request, "post");
    }

Request -

{"password":"Distributor2","username":"Distributor2"}

Ragini
  • 332
  • 1
  • 4
  • 16
  • http://stackoverflow.com/questions/14251851/what-is-406-not-acceptable-response-in-http – AndroidBeginner Feb 21 '17 at 09:48
  • Did u check [this](http://stackoverflow.com/questions/14251851/what-is-406-not-acceptable-response-in-http)? – Piyush Feb 21 '17 at 09:49
  • @AndroidBeginner She mentioned it's working on some devices and not working on others. So this might not be the issue. – Dibzmania Feb 21 '17 at 09:53
  • Please show your code. The part of the code where you are submitting the request and the data that you are sending in the request. The links already posted in the comments section already highlights what is the cause of a HTTP 406. – Dibzmania Feb 21 '17 at 09:57
  • @AndroidBeginner- Its working on emulator and postman but for tablet it is returning 406 exception. – Ragini Feb 21 '17 at 09:57
  • @Dibzmania- added code and request – Ragini Feb 21 '17 at 10:05

0 Answers0