Sorry Olga, still stuck here
I was able to get both silent and normal push notifications to be sent and received using the iOS SDK:
public func sendPushNotificationSync(headers:[String:String?]){
let deliveryOptions = DeliveryOptions()
deliveryOptions.pushPolicy(PUSH_ONLY)
let publishOptions = PublishOptions()
let backendless = Backendless.sharedInstance()
for (header, value) in headers {
publishOptions.addHeader(header, value: value)
}
var error: Fault?
let messageStatus = backendless?.messaging.publish("default",
message: "",
publishOptions:publishOptions,
deliveryOptions:deliveryOptions,
error: &error)
if error == nil {
print("MessageStatus = \(String(describing: messageStatus?.status)) ['\(String(describing: messageStatus?.messageId))']")
}
else {
print("Server reported an error: \(String(describing: error))")
}
}
normal:
let headers = ["ios-alert" : "Webview notification for iOS",
"pushType" : "webView",
"contentUrl" : "[url=https://www.google.com]https://www.google.com"[/url]; ,
"preventExit" : "false",
"ios-sound" : "default",]
sendPushNotificationSync(headers: headers)
silent:
let headers = ["ios-alert" : nil,
"ios-sound" : "",
"pushType" : "callEnded",
"showRating" : "true" ,
"userCode" : "testCode"]
sendPushNotificationSync(headers: headers)
I was NOT able to accomplish the same thing with the javascript SDK (backendless servercode)
const channel = "default";
const message = "1";
const publishOptions = new PublishOptions({
headers: {
"ios-alert":"",
"ios-badge":0,
"ios-sound":"",
"content-available": 1,
a: "a",
b: 2,
c: false
}
});
const deliverOptions = new DeliveryOptions({
pushPolicy: 'ONLY'
});
Backendless.Messaging.publish(channel, message, publishOptions, deliverOptions);