Reputation: 153
I've an android app and need to implement push notification on it, send and receive simple notifications. My scenario; When userY submit form about userX will send userX notification that userY sent you message...
My Question: Do I need to create server side layer (C#, PHP or Node.js) to handle this part, so from android send data to C# and C# send to Firebase ? or there simple way to do it direct from Android application ?
Thank you.
Upvotes: 0
Views: 344
Reputation: 37798
As per my comment, you should have a look at Cloud Functions for Firebase, specifically, Realtime Database Triggers.
Let's say you're using Firebase Realtime Database. For your flow where "userY sends a form to userX", it could go like there'd be a forms
node for a users, where you'll add form
s from other users, and every time a form
is added, you send a notification with Firebase Cloud Messaging. Similar on how you'd send when using Firebase Admin.
Upvotes: 0
Reputation: 3727
You do not need a server to send the message itself. You can even send from the bash shell.
curl -H "Content-Type: application/json " -H "Authorization: key=Your_AUTHKEY" -X POST -d '
{ "data" : { "mykey" : "myvalue"},"notification": {"title": "My test 1","body": "bla bla"}
, "to" : "Your_looong_TOKEN"}'
A problem may arise when passing a token. There can be a useful durability value (write to the base). Just send a post request with the appropriate headers.
Upvotes: 1