I would like to ask that when user like a photo of a another user , i would like to push a notification to the user . I saw this function , and i would like to ask that what is device id ? the user objectId ?
func publishMessageAsPushNotificationAsync(message: String, deviceId: String) {
let deliveryOptions = DeliveryOptions()
deliveryOptions.pushSinglecast = [deviceId]
let publishOptions = PublishOptions()
publishOptions.headers = @{@"android-content-title":@"Notification title for Android",
@"android-content-text":@"Notification text for Android"};
backendless.messaging.publish("default", message: message, publishOptions:publishOptions, deliveryOptions:deliveryOptions,
response:{ ( messageStatus : MessageStatus!) -> () in
print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
},
error: { ( fault : Fault!) -> () in
print("Server reported an error: \(fault)")
}
)
}
What happen if user delete and reinstall the app , it will register the user again right ? and i just wanna push the notification to a certain user base on their names how can i do it ?
After reinstalling the application you must re-register device using Backendless API. Would it happen or not - depends on your code.
You can send a push notification targeting specific user using its deviceId received on registration. Here is a link to docs: https://backendless.com/documentation/messaging/ios/messaging_publish_push_notifications.htm
You can chain users name with it deviceId using afterRegister event handler - put there logic which would update the user which calls registerDevice() method, with deviceId. After that you’ll be able to take deviceId from Users table and send a push notification targeting this device.
I am now trying with samples , pushnotify so when i type the message it should be shown on my console ? when i submit the message in pushnotify , it will give me a push notificaiton right but i am not receiving any
ya , i check my certificate , i notice the recently change in WWDC certicate that make certificate invalid so i download new WWDC certicate . That fixed my problem