How do I send push notifications to a specific user (from the application) through Firebase?

0

I'm developing applications using the Ionic framework. One of the biggest questions I have is how do I work as remote notifications (other than local notifications, easily generated by Ionic).

Using Firebase, I was able to generate remote notifications for all devices and for specific devices, using what they call "registration_id." However, this code represents a device, not the user.

Suppose I have an application with ten users where everyone uses the same device. My question is: How do I send a specific notification to one (or more than one) of these users?

I initially thought that this problem would be solved with a relational table, where it would be possible to relate the application's user ID to its last registered_id , so it is necessary to update this table, if necessary, to every login. However, I see that this solution has some flaws.

    
asked by anonymous 05.03.2018 / 20:41

1 answer

2

There are two ways you can do this. The first is using the Firebase groups . The group is the set of devices of a user. (I have not yet used this Firebase feature, so I do not know if it's easy to deploy)

The second way is to create a topic for the user (ex: user-<ID> ) and to gen- erate that user's devices by adding them to the topic, or removing them.

    
05.03.2018 / 23:42