I need to save FCM tokens to Firebase Database to send notifications. Is there a better way to do it? Now I do it like this:
FirebaseDatabase.getInstance().reference.child("users/${user.uid}/tokens").push().setValue(token)
This way, each time when the token is pushed, it has new unique id and can have same token.
Could you please give me an advice? Or maybe I can do it with firebase functions which will remove duplicates.