#StackBounty: #php #android #android-volley Android : Volley Timeout Error in Chat APP

Bounty: 50

I am working on an chat application where i am using FCM, php backend and Volley for requests.

Initially when i login my application, chat works fine and fast, but after sometime volley timeout error start coming up and as i am not using any retry policy, chat message gets lost.

And if i increase socket time out and use retry policy then app gets hang.

Please help.

Here is my code snippet where i am calling API:

public void doNetworkRequest(int type, String url, final HashMap<String, String> params, Response.Listener requestListener, Response.ErrorListener errorListener) {
        StringRequest mRequest = new StringRequest(type, url, requestListener, errorListener) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                return params;
            }


            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                Map<String, String> headers = new HashMap<String, String>();
                return headers;
            }
        };
//        int socketTimeout = 500000;
//        RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
//        mRequest.setRetryPolicy(policy);
        mQueue.add(mRequest);
    }

UPDATE : This issue is coming almost every API sometimes like login, logout, chatting etc


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.