Simpler method to pass Authorization header with Volley Android

I familiarised myself with passing authorization headers in android using volley library with the help of this answer. The problem is if i have to send multiple requests i need to pass it with each requestwhich makes the code longer. My question is how can i modify the ServerRequest/Request class to make sure the parameters are passed everytime i make a request.

1 answer

  • answered 2019-07-18 15:30 GreenROBO

    You can use Singleton Volley class as described HERE.

    So you will not need to add header everytime when you post your volley request