Home » IBM » C5050-408 » Which server call should the application developer use to deliver the notification?
An application developer intends to deliver a notification to a particular user with ID ‘TestUser".
Which server call should the application developer use to deliver the notification?
A. var notification.target.userlds = [‘TestUser’]; sendMessage(‘TestApplication’,notification);
B. var notification = {} notification.target = {} notification.target.userlds = [‘TestUser’]; sendMessage(‘TestApplication’,notification);
C. var notification = {} notification.message.alert = "notification text"; notification.target.userlds = [‘TestUser’]; sendMessage(‘TestApplication’,notification);
D. var notification = {} notification.message = {} notification.message.alert = "notification text"; notification.target = {} notification.target.userlds = [‘TestUser’]; sendMessage(‘TestApplication’,notification);
Correct Answer: D
Explanation/Reference:
You can send a unicast notification to a particular user in the following way:
* Use the sendMessage method of the WL.Server class. The applicationId and notificationOptions parameters are mandatory.
* The userId(s) as an array in the notificationOptions.target.userIds object.
Example: function sendMessage(msg){ var notificationOptions = {}; notificationOptions.type = 0; notificationOptions.message = {}; notificationOptions.message.alert = msg; notificationOptions.target = {};
References:
https://www.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.dev.doc/devref/c_send_push_notifications.html http://stackoverflow.com/questions/27701167/how-to-trigger-an-alert-once-receiving-push-notifications-using-broadcast-notifi
Download Printable PDF. VALID exam to help you PASS.
|
|