I have a problem with silent notifications on iOS.
When my application is in background, I don\'t receive silent notification sent by FCM. But if I try to send direc
I was working on Firebase silent push notification using nodejs. When I tried below code its was working fine. When I was adding "priority": "high" and "content_available": true it was giving below error.
Worked below code
const admin = require('firebase-admin');
const serviceAccount ="...."; //service account path
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
let fcmToken = "...."; // Your token
let message ={
"token": fcmToken,
"data": {
"updateApi": "activity"
}
}
admin.messaging().send(message)
.then((response) =>{
console.log('Successfully sent notification:', response);
})
.catch((error) =>{
console.log('Error while sending notification:', error);
});
Error when I added the priority and content_available in message object
{ code: 'messaging/invalid-argument',
message: 'Invalid JSON payload received. Unknown name "priority" at \'message\': Cannot find field.\nInvalid JSON payload received. Unknown name "content_available" at \'message\': Cannot find field.' },
codePrefix: 'messaging' }