public class PushNotificationManager extends Object
| Constructor and Description |
|---|
PushNotificationManager()
Constructs a PushNotificationManager
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDevice(String id,
String token)
Deprecated.
The DeviceFactory-based architecture is deprecated.
|
Device |
getDevice(String id)
Deprecated.
The DeviceFactory-based architecture is deprecated.
|
DeviceFactory |
getDeviceFactory()
Deprecated.
The DeviceFactory-based architecture is deprecated.
|
int |
getRetryAttempts()
Get the number of retry attempts
|
void |
initializeConnection(AppleNotificationServer server)
Initialize a connection and create a SSLSocket
|
protected static boolean |
isEnhancedNotificationFormatEnabled()
Check if the enhanced notification format is currently enabled.
|
protected boolean |
isTrustAllServerCertificates()
Get the status of the "trust all server certificates" feature to simplify SSL communications.
|
void |
removeDevice(String id)
Deprecated.
The DeviceFactory-based architecture is deprecated.
|
void |
restartConnection(AppleNotificationServer server)
Stop and restart the current connection to the Apple server
|
PushedNotification |
sendNotification(Device device,
Payload payload)
Send a notification to a single device and close the connection.
|
PushedNotification |
sendNotification(Device device,
Payload payload,
boolean closeAfter)
Send a notification (Payload) to the given device
|
PushedNotification |
sendNotification(Device device,
Payload payload,
boolean closeAfter,
int identifier)
Send a notification (Payload) to the given device
|
PushedNotification |
sendNotification(Device device,
Payload payload,
int identifier)
Send a notification (Payload) to the given device
|
PushedNotifications |
sendNotifications(Payload payload,
Device... devices)
Send a notification to a multiple devices in a single connection and close the connection.
|
PushedNotifications |
sendNotifications(Payload payload,
List<Device> devices)
Send a notification to a multiple devices in a single connection and close the connection.
|
void |
setDeviceFactory(DeviceFactory deviceFactory)
Deprecated.
The DeviceFactory-based architecture is deprecated.
|
static void |
setEnhancedNotificationFormatEnabled(boolean enabled)
Enable or disable the enhanced notification format (enabled by default).
|
static void |
setHeavyDebugMode(boolean enabled)
Enable or disable a special heavy debug mode which causes verbose details to be written to local files.
|
void |
setRetryAttempts(int retryAttempts)
Set the number of retry attempts
|
void |
setSslSocketTimeout(int sslSocketTimeout)
Set the SSL socket timeout to use.
|
void |
setTrustAllServerCertificates(boolean trustAllServerCertificates)
Set whether or not to enable the "trust all server certificates" feature to simplify SSL communications.
|
void |
stopConnection()
Read and process any pending error-responses, and then close the connection.
|
public PushNotificationManager()
protected static boolean isEnhancedNotificationFormatEnabled()
public static void setEnhancedNotificationFormatEnabled(boolean enabled)
enabled - true to enable, false to disablepublic static void setHeavyDebugMode(boolean enabled)
enabled - true to enable, false to disablepublic void initializeConnection(AppleNotificationServer server) throws CommunicationException, KeystoreException
server - The Apple server to connect to.CommunicationException - thrown if a communication error occursKeystoreException - thrown if there is a problem with your keystorepublic void restartConnection(AppleNotificationServer server) throws CommunicationException, KeystoreException
server - the server to startCommunicationException - thrown if a communication error occursKeystoreException - thrown if there is a problem with your keystorepublic void stopConnection()
throws CommunicationException,
KeystoreException
CommunicationException - thrown if a communication error occursKeystoreException - thrown if there is a problem with your keystorepublic PushedNotification sendNotification(Device device, Payload payload) throws CommunicationException
device - the device to be notifiedpayload - the payload to sendCommunicationException - thrown if a communication error occurspublic PushedNotifications sendNotifications(Payload payload, List<Device> devices) throws CommunicationException, KeystoreException
payload - the payload to senddevices - the device to be notifiedCommunicationException - thrown if a communication error occursKeystoreException - thrown if there is a problem with your keystorepublic PushedNotifications sendNotifications(Payload payload, Device... devices) throws CommunicationException, KeystoreException
payload - the payload to senddevices - the device to be notifiedCommunicationException - thrown if a communication error occursKeystoreException - thrown if there is a problem with your keystorepublic PushedNotification sendNotification(Device device, Payload payload, boolean closeAfter) throws CommunicationException
device - the device to be notifiedpayload - the payload to sendcloseAfter - indicates if the connection should be closed after the payload has been sentCommunicationException - thrown if a communication error occurspublic PushedNotification sendNotification(Device device, Payload payload, int identifier) throws CommunicationException
device - the device to be notifiedpayload - the payload to sendidentifier - a unique identifier which will match any error reported later (if any)CommunicationException - thrown if a communication error occurspublic PushedNotification sendNotification(Device device, Payload payload, boolean closeAfter, int identifier) throws CommunicationException
device - the device to be notifiedpayload - the payload to sendcloseAfter - indicates if the connection should be closed after the payload has been sentidentifier - a unique identifier which will match any error reported later (if any)CommunicationException - thrown if a communication error occurs@Deprecated public void addDevice(String id, String token) throws Exception
id - The device idtoken - The device tokenDuplicateDeviceExceptionNullDeviceTokenExceptionNullIdExceptionException@Deprecated public Device getDevice(String id) throws UnknownDeviceException, NullIdException
id - The device idUnknownDeviceExceptionNullIdException@Deprecated public void removeDevice(String id) throws UnknownDeviceException, NullIdException
id - The device idUnknownDeviceExceptionNullIdExceptionpublic int getRetryAttempts()
public void setRetryAttempts(int retryAttempts)
retryAttempts - @Deprecated public DeviceFactory getDeviceFactory()
@Deprecated public void setDeviceFactory(DeviceFactory deviceFactory)
deviceFactory - an object implementing DeviceFactorypublic void setSslSocketTimeout(int sslSocketTimeout)
sslSocketTimeout - protected boolean isTrustAllServerCertificates()
public void setTrustAllServerCertificates(boolean trustAllServerCertificates)
trustAllServerCertificates - Copyright © 2016. All rights reserved.