I'm developing an Android app that involves Firebase Cloud Messaging. My messages consist of notifications with data payload, and are sent to the Firebase server by means of a node.js script. This setup is very similar to what is explained in this Firebase blog, but one difference is that I do not make use of topic subscription, but rather send my messages directly to a user, identified by the Firebase InstanceID token. I keep track of this token for each user in my Firebase database.
This setup works, but when a user logs out my Android app (for example because another user wants to log on using the same device), I have to prevent receiving notifications for the user that just logged off.
I was planning to get a new token when a user logs on:
FirebaseInstanceId.getInstance().getToken();
and release it when that user logs off. However, this is the point where I got lost. In the documentation, I found the command to delete the token:
public void deleteToken (String authorizedEntity, String scope)
but I can't figure out what the strings "authorizedEntity" and "scope" should contain. Can someone point me in the right direction, or am I on the wrong track altogether by deleting tokens (I could hardly find any related questions, which surprised me)?