|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavapns.notification.PushNotificationManager
public class PushNotificationManager
The main class used to send notification and handle a connection to Apple SSLServerSocket. This class is not multi-threaded. One instance per thread must be created.
| Constructor Summary | |
|---|---|
PushNotificationManager()
Constructs a PushNotificationManager |
|
PushNotificationManager(DeviceFactory deviceManager)
Deprecated. The DeviceFactory-based architecture is deprecated. |
|
| Method Summary | |
|---|---|
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. |
static long |
getRestartConnectionAfterInactivity()
|
int |
getRetryAttempts()
Get the number of retry attempts |
int |
getSslSocketTimeout()
Get the SSL socket timeout currently in use. |
void |
initializeConnection(AppleNotificationServer server)
Initialize a connection and create a SSLSocket |
void |
initializePreviousConnection()
Initialize a connection using server settings from the previous connection. |
static boolean |
isResendFeatureEnabled()
|
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. |
static void |
setResendFeatureEnabled(boolean resendFeatureEnabled)
|
static void |
setRestartConnectionAfterInactivity(long restartConnectionAfterInactivity)
|
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. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PushNotificationManager()
@Deprecated public PushNotificationManager(DeviceFactory deviceManager)
deviceManager - | Method Detail |
|---|
public void initializeConnection(AppleNotificationServer server)
throws CommunicationException,
KeystoreException
server - The Apple server to connect to.
CommunicationException - thrown if a communication error occurs
KeystoreException - thrown if there is a problem with your keystore
public void initializePreviousConnection()
throws CommunicationException,
KeystoreException
CommunicationException - thrown if a communication error occurs
KeystoreException - thrown if there is a problem with your keystore
public void restartConnection(AppleNotificationServer server)
throws CommunicationException,
KeystoreException
server - the server to start
CommunicationException - thrown if a communication error occurs
KeystoreException - thrown if there is a problem with your keystore
public void stopConnection()
throws CommunicationException,
KeystoreException
CommunicationException - thrown if a communication error occurs
KeystoreException - thrown if there is a problem with your keystore
public PushedNotification sendNotification(Device device,
Payload payload)
throws CommunicationException
device - the device to be notifiedpayload - the payload to send
CommunicationException - thrown if a communication error occurs
public PushedNotifications sendNotifications(Payload payload,
List<Device> devices)
throws CommunicationException,
KeystoreException
payload - the payload to senddevices - the device to be notified
CommunicationException - thrown if a communication error occurs
KeystoreException - thrown if there is a problem with your keystore
public PushedNotifications sendNotifications(Payload payload,
Device... devices)
throws CommunicationException,
KeystoreException
payload - the payload to senddevices - the device to be notified
CommunicationException - thrown if a communication error occurs
KeystoreException - thrown if there is a problem with your keystore
public 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 sent
CommunicationException - thrown if a communication error occurs
public 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 occurs
public 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 DuplicateDeviceException,
NullIdException,
NullDeviceTokenException,
Exception
id - The device idtoken - The device token
DuplicateDeviceException
NullDeviceTokenException
NullIdException
Exception
@Deprecated
public Device getDevice(String id)
throws UnknownDeviceException,
NullIdException
id - The device id
UnknownDeviceException
NullIdException
@Deprecated
public void removeDevice(String id)
throws UnknownDeviceException,
NullIdException
id - The device id
UnknownDeviceException
NullIdExceptionpublic int getRetryAttempts()
public void setRetryAttempts(int retryAttempts)
retryAttempts - @Deprecated public void setDeviceFactory(DeviceFactory deviceFactory)
deviceFactory - an object implementing DeviceFactory@Deprecated public DeviceFactory getDeviceFactory()
public void setSslSocketTimeout(int sslSocketTimeout)
sslSocketTimeout - public int getSslSocketTimeout()
public void setTrustAllServerCertificates(boolean trustAllServerCertificates)
trustAllServerCertificates - 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 static void setResendFeatureEnabled(boolean resendFeatureEnabled)
public static boolean isResendFeatureEnabled()
public static void setRestartConnectionAfterInactivity(long restartConnectionAfterInactivity)
public static long getRestartConnectionAfterInactivity()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||