I am trying to use the firebase FCM services to send notification to users. when a user logins, i store its token_id to the Firestore database.
this is how i store the token_id.
String token_id = FirebaseInstanceId.getInstance().getToken();
Log.i("token_id",token_id);
Map<String,Object> tokenMap = new HashMap<>();
tokenMap.put("token_id",token_id);
mFireStore.collection("Users").document(current_id).update(tokenMap).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(LoginActivity.this, "Signed in Successfully", Toast.LENGTH_SHORT).show();
startActivity(new Intent(LoginActivity.this,AdminActivity.class));
finish();
}
});
but when i login with the same user in different device, the previous token_id gets update with the new one..
is there any way that i can create a list of token_ids so that i can use it in the node.js function