0

I am building a server that sends a notification to all the devices who have my app installed. I have setup firebase admin and this is my code:

const serviceAccountCredentials = require('path/to/serviceaccount');
const admin = require('firebase-admin');
admin.initializeApp({
    credential: admin.credential.cert(serviceAccountCredentials),
    databaseURL: "url here"
});
const messaging = admin.messaging()

var payload = {
    notification: {
        title: "This is a Notification",
        body: "This is the body of the notification message.",
    },
    condition: 'App Classic Sudoku Android'
};


messaging.send(payload).then((result: any) => {console.log(result)});

console.log("ran");

What I am doing is fairly easy to understand, my question is how do i target the devices who have installed my app to send a cloud message/notification to. I tried every possible phrase to do so in the condition parameter in the payload object, but it didn't work. I couldn't find it in the docs either.

Any help is appreciated

Joel
  • 167
  • 1
  • 15
  • There is no built-in way to target all devices that have your app installed. See the question I linked, and specifically my answer to it: https://stackoverflow.com/a/38427849 – Frank van Puffelen Jan 02 '22 at 16:12

0 Answers0