'Device ID is not going to the heasers

Im working on Registration using volley liabray.I want to send Device ID in header but it going null here is my code snippit.

   Log.d("TAG", "Details:" + response);
                        String strMessage = response.optString("message");
                        String strDevice = response.optString("deviceID");
                        CryptoHandler cryptoHandler = new CryptoHandler();
                   
                            String decryptMessage = cryptoHandler.decrypt(strMessage);
                            String decryptDevice = cryptoHandler.decrypt(strDevice);
                            Log.d("TAG","Decrypted Response:"+decryptMessage +decryptDevice);
                        
                        // responseTV.setText("String Response : " + response.toString());
                        Intent i = new Intent(getApplicationContext(), LoginActivity.class);
                        startActivity(i);
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {

// responseTV.setText(error.getMessage()); // Toast.makeText(RegisterActivity.this, "Error"+error, Toast.LENGTH_LONG).show(); if (error instanceof NetworkError) { } else if (error instanceof ServerError) { } else if (error instanceof AuthFailureError) { } else if (error instanceof ParseError) { } else if (error instanceof NoConnectionError) { } else if (error instanceof TimeoutError) { Toast.makeText(getApplicationContext(), "Oops. Timeout error!", Toast.LENGTH_LONG).show(); } } //This is for Headers If You Needed

        }) {
            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                HashMap<String, String> headers = new HashMap<>();

                headers.put("DeviceId", ID);
                return headers;
            }
        };


        requestQueue.add(jsonObjectRequest);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source