Reputation: 5243
I am really rookie and need an advice.
I have read documentation, and as far as i understood if you need send direct message, follow next steps:
Firebase TokenId
and
userId
json
and put
inside topic
text
and resipent userId
so on...json
via HTTP to your server sidejson
, it should use Firebase API to
create new message bloc child
with random name in firebasefirebase tokenId
In order to sent notification .child
It is as i understood this consept, fix me please if smth wrong?
Upvotes: 1
Views: 4953
Reputation: 598775
Your suggested approach sounds good. The most important thing to realize is that you require an app server to send a downstream message to a device. Using the database as the communication mechanism between the app and the app server is a popular approach.
You could also use Cloud Messaging's upstream capabilities. But I've never tried that approach, because the database works fine for me and I had little interest in learning yet another protocol (XMPP).
You can read how I implemented it in this Firebase blog post Sending notifications between Android devices with Firebase Database and Cloud Messaging.
Upvotes: 1