12
votes

I recently signed up to use Firebase and I can't seem to figure out how to push notifications to specific users.

For my use, I guess you can think of it like Facebook. Whenever a user does something, say posts an interesting article for their friends to read, I want all of the user's friends to be notified of that event. So, using Firebase, how would one make it possible to notify only their friends and not everyone? My database stores the conenctions.

Perhaps there is a way to have each user be a node in the Firebase database and each time a notification is sent, The user will constantly check his node, and if something appears, pulls it and then delete it.

The examples on Firebase seems to be sort of basic. I wish there was a user-specific push notification example.

2
try to do the that i say here: stackoverflow.com/questions/37435750/… After you say me ok.Paulo Linhares - Packapps
Here See My Documentation i use it and Work fine for me => See My Code On StackoverflowSanandiya Vipul
You can using user's registration id. visit this blog for more details codingaffairs.blogspot.com/2016/06/…Developine

2 Answers

9
votes

Now Firebase supports Push Notification. Google rebranded GCM to Firebase Cloud Messaging and it now offers this cross platform service. Firebase also offers notifications.

These are the differences between these two services:

Firebase Cloud Messaging provides a complete set of messaging capabilities through its client SDKs and HTTP and XMPP server protocols. For deployments with more complex messaging requirements, FCM is the right choice.

Firebase Notifications is a lightweight, serverless messaging solution built on Firebase Cloud Messaging. With a user-friendly graphical console and reduced coding requirements, Firebase Notifications lets users easily send messages to reengage and retain users, foster app growth, and support marketing campaigns. If you want a more detailed comparison. Read this.

2
votes

There's a good explanation of how you can send notifications to specific users here: How to send an alert message to a special online user with firebase

Basically you need to have each user observe a unique path, and then write data updates to the appropriate path.