I want to send device Token information when sending membership information to server.
But how should I go because getToken is no longer in use?
I've been using this before:
params.put("deviceToken", FirebaseInstanceId.getInstance().getToken());
Easy and worked but getToken
is deprecated
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, "Registration Error: " + error.getMessage());
Toast.makeText(getApplicationContext(),
error.getMessage(), Toast.LENGTH_LONG).show();
hideDialog();
}
}) {
@Override
protected Map<String, String> getParams() {
// Posting params to register url
Map<String, String> params = new HashMap<String, String>();
params.put("name", name);
params.put("email", email);
params.put("password", password);
params.put("deviceToken", deviceTokenID); <<<---- DEVICE ID TOKEN
return params;
}
};
// Adding request to request queue
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
To solve this, you need to use a success listener like in the following lines of code: