public class NotificationBuilder extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NotificationBuilder.APNSNotificationType |
static class |
NotificationBuilder.GCMPriority |
static class |
NotificationBuilder.PushNotificationsPlatform |
| Modifier and Type | Field and Description |
|---|---|
protected org.json.JSONObject |
notification |
| Constructor and Description |
|---|
NotificationBuilder(String alert)
Create a new NotificationBuilder to help create a new push notification.
|
| Modifier and Type | Method and Description |
|---|---|
org.json.JSONObject |
build()
Build the push notification as configured.
|
NotificationBuilder |
setAPNSSettings(Integer badge,
String category,
String iosActionKey,
org.json.JSONObject payload,
String soundFile,
NotificationBuilder.APNSNotificationType type)
Configure specific Apple Push Notification Service (APNS) settings for iOS devices.
|
NotificationBuilder |
setGCMSettings(String collapseKey,
Boolean delayWhileIdle,
org.json.JSONObject payload,
NotificationBuilder.GCMPriority priority,
String soundFile,
Integer secondsToLive)
Configure specific Google Cloud Messaging (GCM) settings.
|
NotificationBuilder |
setMessageURL(String url)
Set an optional URL to be included with the push notification.
|
NotificationBuilder |
setTarget(String[] deviceIds,
NotificationBuilder.PushNotificationsPlatform[] platforms,
String[] tagNames)
Specify the targets that will receive the push notification.
|
public NotificationBuilder(String alert)
alert - the message to be sent in the push notificationpublic NotificationBuilder setMessageURL(String url)
url - the URL to be includedpublic NotificationBuilder setTarget(String[] deviceIds, NotificationBuilder.PushNotificationsPlatform[] platforms, String[] tagNames)
deviceIds - an optional array of device ids specified as strings that the push notification will be sent toplatforms - an optional array of NotificationBuilder.PushNotificationsPlatform enums used to specify which platforms to send totagNames - an optional string array with the list of tags that will receive the notificationpublic NotificationBuilder setAPNSSettings(Integer badge, String category, String iosActionKey, org.json.JSONObject payload, String soundFile, NotificationBuilder.APNSNotificationType type)
badge - the number to display as the badge of the application iconcategory - the category identifier to be used for intereactive push notificationsiosActionKey - the title for the Action keypayload - custom JSON payload that will be sent as part of the notification messagesoundFile - the name of the sound file in the application bundle; the sound of this file is played as an alerttype - determines whether an alert is shown or the message is placed in the notification center; specified with the NotificationBuilder.APNSNotificationType enumpublic NotificationBuilder setGCMSettings(String collapseKey, Boolean delayWhileIdle, org.json.JSONObject payload, NotificationBuilder.GCMPriority priority, String soundFile, Integer secondsToLive)
collapseKey - key that identifies a group of push notifications that can be replaced with the latest onedelayWhileIdle - indicates whether the message should not be sent until the device becomes activepayload - custom JSON payload that will be sent as part of the notification messagepriority - the priority of the message, specified using the NotificationBuilder.GCMPriority enumsoundFile - the sound file (on device) that will be attempted to play when the notification arrives on the devicesecondsToLive - specifies how long (in seconds) the message should be kept in GCM storage if the device is offlinepublic org.json.JSONObject build()
PushNotifications.send(JSONObject, PushNotificationsResponseListener) as a parameter.Copyright © 2017. All rights reserved.