I am trying to get firebase cloud functions to send a iOS push notification. Firebase cloud function log states that the message has been sent successfully, but notification never arrives on the device.
The device is able to receive push notifications which are sent via Firebase Cloud Messaging
I have tested on multiple devices.
The device is able to receive push notifications which are sent via Cloud Messaging.
I have tested on multiple devices.
Please see the relevant firebase function.
exports.testMessage = functions.https.onCall((data, context) => {
console.log('test message started')
var message = {
notification: {
title: 'Test title',
body:'Test body'
},
token: '...' // Token is inserted here.
};
return admin.messaging().send(message)
.then((response) => {
// Response is a message ID string.
console.log('Successfully sent message:', response);
return { 'message': 'sent' }
}).catch((error) => {
console.log('Error sending message:', error);
return { 'message': 'failed' }
});
})
Any help would be appreciated.