Broadcast notifications in native iOS 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 unsubscribing the device from the reserved Push.ALL tag.
For more information about broadcast notification, see the topics about broadcast notification topic in the user documentation.
Common API methods for tag-based and broadcast notifications
Client-side API:When a notification is received by a device, the
didReceiveRemoteNotificationmethod in the app delegate is called. The logic to handle the notification should be defined here.
- userInfo - A JSON block that contains the payload field. This field holds other data that is sent from the MobileFirst Platform server. It also contains the tag name for tag and broadcast notification. The tag name appears in the tag element. For broadcast notification, the default tag name is
- This method registers a listener to be used for push notifications. This listener should implement the OnReadyToSubscribe() method.
WL.Server.sendMessage(applicationId,notificationOptions)This method submits a notification based on the specified target parameters and takes two mandatory parameters:
applicationId- (mandatory) The name of the MobileFirst application
notificationOptions- (mandatory) A JSON block containing message properties
For a full list of message properties, refer to the
WL.Server.sendMessageAPI in the API reference documentation.
Sample applicationBefore running the application, check the adapter's
PushAdapter-impl.jsfile and verify that the
WL.Server.sendMessage()method use the correct application name. The correct application name can be determined from the
application-descriptor.xml. Click to download the Studio project Click to download Native project ▲
Last modified on November 09, 2016