Closed ademir10 closed 3 years ago
Hi @ademir10,
For iOS, you must specify the notification
key with a body
:
var message = new gcm.Message({
data: {
key1: 'message1',
key2: 'message2'
},
notification: {
title: "Hello, World",
icon: "ic_launcher",
body: "This is a notification that will be displayed if your app is in the background."
}
});
Hi @ademir10, For iOS, you must specify the
notification
key with abody
:var message = new gcm.Message({ data: { key1: 'message1', key2: 'message2' }, notification: { title: "Hello, World", icon: "ic_launcher", body: "This is a notification that will be displayed if your app is in the background." } });
Yep! I found it after couple hours hahahah. Thank you my dear friend! God bless you
Hi guys! I'm trying to send notifications using this plugin and everything is working fine with Android devices but i can't make it work with ios devices.
I'm sure that everything is okay with firebase because when i try to send a test message from there, i receive the test message, but when i try to do the same through my NodeJS API, it's working only to Android devices.
Do you know if need to make something else when i send messages to ios?
This is my code: var gcm = require('node-gcm'); // Server token firebase var sender = new gcm.Sender('AAAAVfnX-18:APA91bEuukPhVF-.............'); // Prepare a message to be sent var message = new gcm.Message({ data: { key1: 'Test message here' } }); // Token generated in my Front-End (App) var regTokens = ['cXSdaAPtV0X8h1SJ5NjjDC:APA91bHv16gWO8185NytrOtw9LHSuViJMOOctRAwkE4OoCIFUIrDAmYe7-MtHp4pXimgO9muoNoINtjxZoeDbA4tovV6pjNdXoTTfA_8RrGP51CFzPAgA1bJR3uPEpZEpp3EgOv3flEb']; // Actually send the message sender.send(message, { registrationTokens: regTokens }, function (err, response) { if (err) console.error(err); else console.log(response); });
Any suggestion? thank you.