Broadcast notifications in Hybrid applications
OverviewBroadcast notification are in fact tag-based notification, where a subscription to a reserved tag,
Push.ALL, is auto-created for every device. Broadcast notifications are thus notification messages that are targeted to all subscribed devices. Broadcast notifications are enabled by default for any push-enabled MobileFirst application. This ability can be disabled by by unsubscribing from the reserved
For more information about broadcast notifications, see the user documentation.
Common API methods for tag-based and broadcast notifications
WL.Client.Push.onMessage (props, payload)
- props - A JSON block that contains the notifications properties of the platform.
- payload - A JSON block that contains other data that is sent from the MobileFirst Server. It also contains the tag name for tag and broadcast notification. The tag name appears in the "tag" element. For broadcast notification, default tag name is
Push.ALLis sent back in the payload parameter.
WL.Server.sendMessage(applicationId,notificationOptions)applicationId - (mandatory) The name of the MobileFirst application. notificationOptions - (mandatory) A JSON block containing message properties. Submits a notification based on the specified target parameters.
For a full list of message properties, refer to the WL.Server.sendMessage API in the API reference of user documentation
Sample applicationClick to download the Studio project. The provided sample application demonstrates sending a broadcast notification to the default auto-subscribed
push.ALLtag. The sample also demonstrates sending notifications to two pre-defined tags, sample-tag1 and sample-tag2, to which the user can selects to subscribe to in the application.
Last modified on March 13, 2017