1

is there any way to send a notification to multiple device when a button is clicked in android(java) using Firebase.?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Hello and welcome to StackOverflow. Yes, you can achive it by suscribing your users to a topic. https://firebase.google.com/docs/cloud-messaging/android/topic-messaging – Brugui Apr 01 '21 at 12:19
  • 1
    I have explained in one of my **[tutorials](https://www.youtube.com/playlist?list=PLn2n4GESV0AmXOWOam729bC47v0d0Ohee)** step by step, how you can send **[notifications](https://www.youtube.com/watch?v=6RzB4HXzQyA&t=3s&list=PLn2n4GESV0AmXOWOam729bC47v0d0Ohee&index=17)** to specific users using `Cloud Firestore` and `Node.js`. You can also take a look at my answer from this **[post](https://stackoverflow.com/questions/48298993/push-notifications-on-content-change/48299840)**. – Alex Mamo Apr 01 '21 at 12:40
  • Thankyou. it really helped. – sangeeth kumar Apr 02 '21 at 16:05

1 Answers1

1

From this Post and Firebase docs :

Firebase Cloud Messaging (FCM) topic messaging allows you to send a message to multiple devices that have opted in to a particular topic.

From Server side you need to set up for specif topic i.e a group of user like this:

https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

{
  "to": "/topics/news",
  "data": {
    "message": "This is a Firebase Cloud Messaging Topic Message!",
   }
}

"/topics/news" This will send notification to group of peopl

Med Elgarnaoui
  • 1,612
  • 1
  • 18
  • 35