Reputation: 1641
First of all i'm new to Android and Firebase. I made two applications:
The first application is for the customer. The customer can fill a report and hit the send button. A report has a title, description and status. After sending the report i'm saving the title, description, status, timestamp and the authentication ID of the sender in the realtime database of Firebase.
The second application is for the employees. Every employee has his own ID. This application is connected to the same Firebase project. Every employee has his own working times (described in a calendar within the database). The employee can view reports and change their status.
I got a method that can search for the employee ID that works at the time of sending a report.
I want to send a notification to a specific employee based on his ID when a report has been sent.
Can anyone advice me what technology i could use for this and if possible an example. I've been searching alot but couldn't figur it out.
Thanks in advance!
Upvotes: 2
Views: 73
Reputation: 13129
You will need to use Firebase Functions in order to do it.
First, you will need to register the device tokens ID at your desired database (Firestore or Realtime Database)
String token = FirebaseInstanceId.getInstance().getToken();
Then, you should have a Function that triggers when some event happens, in that function you will need to retrieve the Tokens of the devices you want to share any message and create a notification payload with your desired message.
An example of notifications can be found at GitHub repo.
In this case you will need to use fcm-notifications
Since the applications are connected to the same firebase project, there is no problem storing tokens from different devices and sending notifications, since each app should handle the same logic to get them.
Upvotes: 4