Firebase Cloud Messaging device id: multiple users in one application on one device

Is there a way to create a registration ID with the volume of the registered user. I have an application that allows a user to log in as another user (say, one user as a student and the other as a parent). User can switch between users. The case is similar to the gmail application, in which several email identifiers can be registered simultaneously.

The problem is when we call

 FirebaseInstanceId.getInstance().getToken()

It will provide the device identifier for this instance of the application. Therefore, if I am targeting a specific user that I have registered, I cannot.

One of the ways that I can target a user is to send user_idexplicitly as data, which in my case is inefficient, since I will need to send one request to send FCM for each user. In any case, this can be achieved. I’d like to know how gmail handles user notifications.

+4
source share
1 answer

Token (reg id) is intended to represent a mobile device.

, , push-, , , .

, , . , .

+3

Source: https://habr.com/ru/post/1678156/


All Articles