Two questions actually.
First question, how can I send a sound with my iOS Push Notification when using codeless? There doesn’t seem to be an option to put a sound file.
Secondly, how can I send a iOS push notification to just one user also using codeless? The only thing i can currently think of is to have each person in their own channel.
Hi, Sean
yeah, currently the codeless block for sending Push Notifications supports only minimal options, but I can propose you a workaround for it:
- create a API Service “PushNotification” which will accept any options
- add a single method for sending pushes
- and use the service/method in your Codeless logic
the service’s code:
'use strict';
class PushNotification {
/**
*
* @param {String} channel
* @param {String} message
* @param {Object} publishOptions
* @param {Object} deliveryOptions
* @returns {Object}
**/
send(channel, message, publishOptions, deliveryOptions) {
publishOptions = publishOptions ? new Backendless.PublishOptions(publishOptions) : null
deliveryOptions = deliveryOptions ? new Backendless.DeliveryOptions(deliveryOptions) : null
return Backendless.Messaging.publish(channel, message, publishOptions, deliveryOptions)
}
}
Backendless.ServerCode.addService(PushNotification)
http://support.backendless.com/public/attachments/08146df2b49b27b4483fb443b4ec0656.png</img>
see all the available Push Notification Headers here https://backendless.com/docs/js/doc.html#headers
Regards, Vlad