android – I want to send push notification to specific users using PHP and gcm-ThrowExceptions

Exception or error:

I am working on an Android project.
In that I need to send some notifications on background on the basis of condition on MySQL database…
How can I use PHP to send notification to certain users after checking the condition.

How to solve:

Follow below steps to achieve this,

  1. Get the device token using Firebase SDK and store it in your mysql database against user (https://firebase.google.com/docs/cloud-messaging/android/client)
  2. Select device tokens matching your criteria (SQL Query)
  3. Send the push message to selected device using firebase rest api (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send, How can I send a Firebase Cloud Messaging notification without use the Firebase Console?)

Leave a Reply

Your email address will not be published. Required fields are marked *