我想从Node.Js代码向使用Ionic t开发的我的Android应用发送通知。我已尝试以下代码并收到“其中一个主题、令牌或条件是必需的”的错误消息。如何在没有任何条件的情况下向所有用户发送通知?
var serviceAccount = require("/path/to/config.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://myApp.firebaseio.com"
});
var message = {
notification: {
title: '$GOOG up 1.43% on the day',
body: '$GOOG gained 11.80 points to close at 835.67, up 1.43% on the day.'
}
};
admin.messaging().send(message).then(res=>{
console.log("Success",res)
}).catch(err=>{
console.log("Error:",err)
})