I am trying this approach to send push notifications from cloud code using Parse Server push adapter. The notifications is delivered successfully but the problem is how to use the 'content-available' flag. I'm not sure if i am using the flag the right way because the app is not being awaking when the notifications arrives as it should be.
This is the code:
Parse.Push.send({
where: query,
data: {
alert: 'One more test 1',
badge: 1,
sound: 'default',
content_available: 1
}
}, { useMasterKey: true });
Again, the notifications arrives but the 'content-available' flag is not working. is anyone using this approach to send push notifications? Where should i put the 'content-available'?
Thank you all!
Well i got it! It's easier than i thought.
This would be the correct code:
Parse.Push.send({
where: query,
data: {
alert: 'One more test 1',
badge: 1,
sound: 'default',
objectId: user.id,
'content-available': 1
}
}, { useMasterKey: true });
The 'content-available' flag should be separated using dash ("-") and the entire phrase between quotes.
And that's it! Hope this could help someone struggling with this like i was.
Have a great code!