I want to send notification all users in app, Android developer subscribed topic name with ALL_USER but I am not able to send notification to that topic.
Thanks for help in Advance.
CodePudding user response:
Try this -
From your firebase project download the JSON file which contains the server key and places it in the root folder privatekey.json.
Use the below code in your API or function.
var fcm = require('fcm-notification'); var FCM = new fcm('./privatekey.json'); var message = { topic: topic, notification: { title: title, body: body } }; FCM.send(message, function (err, response) { if (err) { console.log("Something has gone wrong!" err); } else { console.log("Successfully sent with response: ", response); } });