Notifications real-time chat on android with firebase

0

We are developing an app that uses real-time chat between users (how to WhatsApp) and we have the doubt to know how to make us notify (and sound) each time a user writes to another. The messages arrive between users, but they do not know they notify, they have to enter the message section and check if they really have a message or not. We have seen that firebase has the cloud messaging, but we are not sure that this will work between users, and if they are only messages that we can program to send every so often to the users (how offers and others). If someone could help us out, it would be appreciated. We use firebase in android. Thanks.

    
asked by AnnaPS 11.08.2018 в 11:52
source

1 answer

0

It is a bit complex to explain it but I am going to the case

to make this notification system you will need to obtain the device_token of each user, store it in Firebase and store the UID of each user

These notifications are sent between users, so you have to use Functions of Firebase to achieve this

link

Functions works with javascript, you will have to configure a payload with the notification for users to communicate, and in my app I have the following structure for notifications among users for example: such a user started to follow you

here in functions notify me of who comes the notification

To make the script you will need a comfortable text editor as a sublime text, and I recommend you watch this video to see how to build the script and how to deploy it

link

I hope it serves you!

pd: the video is a little old, so functions is updated and some things that the video shows do not work at all, likewise in the comments this is the majority of the solutions or you can go here if you have any problem with javascript

    
answered by 11.08.2018 в 21:27