I'm working on a doorbell project in which I want to send Push Notification to user when a guest come and ring the doorbell, it should send a Push Notification to the user (i.e owner of house). I want to use Firebase Cloud Messaging for this in my android app.
We are using RaspberryPi as the hardware controller. It will trigger notification to user using FCM on their android device when someone presses their doorbell.(which is not a point of concern.)
My confusion is:
According to this post on SO, FCM will send Push Notification to the predefined 'registration_ids' which we have mentioned in the app. But in my case, every user will have their different registration ids. Also the number of users are not fixed.
It could be any number of users. Whoever uses the doorbell will have their own id.
So it will be a possible scenario like:
suppose I have not mentioned any registration id in app. 10 users have installed this doorbell at home and someone on the house no 1 presses doorbell button, the FCM will send push notification to all the 10 users. Reason is, the registration id will be same for all the devices who have installed app from PlayStore.
suppose I have mentioned 3 registration id in app. So 3 users will be getting the same Push Notification at the same time.
And if i'm not wrong, if i put only 1 registration id, only 1 user will get notification even if 5 different house's doorbell are pressed, the same user will be notified 5 times.
If i declare a specific registration id to be notified in server side (i.e RaspberryPi), I have to regularly add new registration ids as the number of users increases in my app and update it frequently.
So how do I resolve this problem ?
I haven't started developing this app till now because I'm confused with the first step itself.
If I've gone wrong somewhere, please guide me as I'm new to Push Notifications or FCM. I may not have understood concept of FCM, which is possible but I'm not sure. If this solution is not possible using FCM, suggest me some other options to achieve this please.