1

I got two mobile apps for service provider and customer, i need to send push notifications for service provider user once the customer requests a specific service type. So it needs to be filtered and send only for those who can provide such a service. Therefore web api needs to send the notification only for specific users, how can i do that with firebase should i use, device mac or registration id generated by firebase.

Any help

Lakshan
  • 297
  • 1
  • 3
  • 14
  • there are some thing called topics https://firebase.google.com/docs/cloud-messaging/android/topic-messaging, or save the device token in server when user subscribes to a service and send notification to only those tokens – Manohar Aug 26 '19 at 07:39
  • 1
    I don't recommend Topics because Topics are supposed to be "public" and readable by anyone who wants to subscribe to it. It's not meant to send private messages. – Zun Aug 26 '19 at 07:48
  • Check also **[this](https://stackoverflow.com/questions/48298993/push-notifications-on-content-change/48299840)** out. – Alex Mamo Aug 26 '19 at 09:40

2 Answers2

3
  1. register a new project in FCM console.
  2. Make android/ios and web(for configuration) application.
  3. The first-time app will be loaded it gives device token and store to the database.
  4. by using device token you can send a notification to a particular device.

Reference link:- https://www.djamware.com/post/5c6ccd1f80aca754f7a9d1ec/push-notification-using-ionic-4-and-firebase-cloud-messaging

Raj Gohel
  • 999
  • 7
  • 14
1
  1. First you have to get the fire base token from android app.
  2. Register your mobile app in Firebase console.
  3. If you have any user login api and database, send the fire base token while user login your app and save the token against the user.
  4. Whenever the user request for service you can get the token of the particular user and send a message to fire base api with that token from server side.
  5. It will automatically send the message to that particular device whoever login your app.
  6. Make sure you update the token while if other user login your app in same device.
PrasathBV
  • 303
  • 4
  • 11