I am working on an app in which i have 2 type of users consider A,B
A is the admin of a society
B is the members of that society(Multiple members)
A sends notice to all B .I want to send this notice as push notification.
I have gone through the google FCM but I am unable to understand how to implement it in my situation .
I am new to android ,please help me ,Thanks.
Asked
Active
Viewed 1,477 times
0

Saket Mayank
- 55
- 1
- 16
-
Start from https://firebase.google.com/docs/cloud-messaging/android/client – ADM Mar 22 '18 at 07:35
-
Thanks for the reply ,I have gone through them but I am unable to understand how to group all user B and link to A .They provide Send message to Topics ,Send Message to Device Groups. – Saket Mayank Mar 22 '18 at 07:53
-
Question is too broad . Add `Firebase` tag in question . It will help . – ADM Mar 22 '18 at 07:55
-
Read https://firebase.google.com/docs/cloud-messaging/android/send-multiple And https://stackoverflow.com/questions/39547277/fcm-firebase-cloud-messaging-send-to-multiple-devices. – ADM Mar 22 '18 at 08:01
-
Thanks ,going through it . – Saket Mayank Mar 22 '18 at 08:08
-
You need some kind of backend for this, for example, php, user A will send a notice and that notice will be sent to the backend using some API call and then when that data is received on the backend it will hit the firebase server which will send the notification to all the users – Paras Watts Mar 22 '18 at 08:49
-
@ParasWatts you are right , i have a backend for this which is sending the notice within the app and not as notification . I want to target only those users(B) which are attached with user admin(A). There can be multiple admins (A's) and subsequently multiple B's. I was going through google FCM and got an idea about sending notification using Topics. I am not sure whether i am approaching right or not. – Saket Mayank Mar 22 '18 at 10:04
-
That is a login part, what you can do is in MySql table for users add an admin column also to identify the admin of a particular user. Then when you receive a notice from the admin using api , query all those results from the database which have that particular admin and then send the notifications to all those users using their reg_id's. On user end make an api to send latst reg_id to the server. – Paras Watts Mar 22 '18 at 10:36
-
Are you hitting the fcm server from your backend? – Paras Watts Mar 22 '18 at 10:37
-
No I am not hitting the FCM server from backend for now but I will . – Saket Mayank Mar 22 '18 at 11:32
-
I have made unique Topic for every user A and for subsequent user B's I am letting them subscribe to that particular topic .Thus receiving the push notification as I wanted .But is it the correct approach ? – Saket Mayank Mar 22 '18 at 11:35