Hamdan Ali
Hamdan Ali

Reputation: 53

How to Send Push Notifications Using Group Messaging Firebase?

I am creating a college Android application where faculty choose the specific course and send them assignment notification but how i do that i don't Know... please help me..

Upvotes: 1

Views: 542

Answers (1)

Mahesh
Mahesh

Reputation: 2892

You need to subscribe topic from Android app. Send notifications to that topic so it will received to all users who has subscribed it.

Sample code subscribe top from Android app.

FirebaseMessaging.getInstance().subscribeToTopic("news");

Send message to this topic from server- URL- https://fcm.googleapis.com/fcm/send Body-

{
  "to": "/topics/news",
  "data": {
    "message": "Message to user",
    "title":"title of message",
    "sender":"sender name"
   }
}

headers- api key from firebase

Rest you need write code from Android and Server side. You can also send notifications form Firebase console as well.

Upvotes: 2

Related Questions