public interface ApnsService
ApnsServiceBuilder
like:
ApnsService = APNS.newService() .withCert("/path/to/certificate.p12", "MyCertPassword") .withSandboxDestination() .build()
Modifier and Type | Method and Description |
---|---|
Map<String,Date> |
getInactiveDevices()
Returns the list of devices that reported failed-delivery
attempts to the Apple Feedback services.
|
void |
push(ApnsNotification message)
Sends the provided notification
message to the desired
destination. |
ApnsNotification |
push(byte[] deviceToken,
byte[] payload)
Sends a push notification with the provided
payload to the
iPhone of deviceToken . |
EnhancedApnsNotification |
push(byte[] deviceToken,
byte[] payload,
int expiry) |
Collection<? extends ApnsNotification> |
push(Collection<byte[]> deviceTokens,
byte[] payload)
Sends a bulk push notification with the provided
payload to iPhone of deviceToken s set. |
Collection<? extends EnhancedApnsNotification> |
push(Collection<byte[]> deviceTokens,
byte[] payload,
int expiry) |
Collection<? extends ApnsNotification> |
push(Collection<String> deviceTokens,
String payload)
Sends a bulk push notification with the provided
payload to iPhone of deviceToken s set. |
Collection<? extends EnhancedApnsNotification> |
push(Collection<String> deviceTokens,
String payload,
Date expiry) |
ApnsNotification |
push(String deviceToken,
String payload)
Sends a push notification with the provided
payload to the
iPhone of deviceToken . |
EnhancedApnsNotification |
push(String deviceToken,
String payload,
Date expiry) |
void |
start()
Starts the service.
|
void |
stop()
Stops the service and frees any allocated resources it created for this
service.
|
void |
testConnection()
Test that the service is setup properly and the Apple servers
are reachable.
|
ApnsNotification push(String deviceToken, String payload) throws NetworkIOException
payload
to the
iPhone of deviceToken
.
The payload needs to be a valid JSON object, otherwise it may fail
silently. It is recommended to use PayloadBuilder
to create
one.deviceToken
- the destination iPhone device tokenpayload
- The payload messageNetworkIOException
- if a network error occurred while
attempting to send the messageEnhancedApnsNotification push(String deviceToken, String payload, Date expiry) throws NetworkIOException
NetworkIOException
ApnsNotification push(byte[] deviceToken, byte[] payload) throws NetworkIOException
payload
to the
iPhone of deviceToken
.
The payload needs to be a valid JSON object, otherwise it may fail
silently. It is recommended to use PayloadBuilder
to create
one.deviceToken
- the destination iPhone device tokenpayload
- The payload messageNetworkIOException
- if a network error occurred while
attempting to send the messageEnhancedApnsNotification push(byte[] deviceToken, byte[] payload, int expiry) throws NetworkIOException
NetworkIOException
Collection<? extends ApnsNotification> push(Collection<String> deviceTokens, String payload) throws NetworkIOException
payload
to iPhone of deviceToken
s set.
The payload needs to be a valid JSON object, otherwise it may fail
silently. It is recommended to use PayloadBuilder
to create
one.deviceTokens
- the destination iPhone device tokenspayload
- The payload messageNetworkIOException
- if a network error occurred while
attempting to send the messageCollection<? extends EnhancedApnsNotification> push(Collection<String> deviceTokens, String payload, Date expiry) throws NetworkIOException
NetworkIOException
Collection<? extends ApnsNotification> push(Collection<byte[]> deviceTokens, byte[] payload) throws NetworkIOException
payload
to iPhone of deviceToken
s set.
The payload needs to be a valid JSON object, otherwise it may fail
silently. It is recommended to use PayloadBuilder
to create
one.deviceTokens
- the destination iPhone device tokenspayload
- The payload messageNetworkIOException
- if a network error occurred while
attempting to send the messageCollection<? extends EnhancedApnsNotification> push(Collection<byte[]> deviceTokens, byte[] payload, int expiry) throws NetworkIOException
NetworkIOException
void push(ApnsNotification message) throws NetworkIOException
message
to the desired
destination.NetworkIOException
- if a network error occurred while
attempting to send the messagevoid start()
NetworkIOException
- if a network error occurred while
starting the servicevoid stop()
Map<String,Date> getInactiveDevices() throws NetworkIOException
NetworkIOException
- if a network error occurred
while retrieving invalid device connectionvoid testConnection() throws NetworkIOException
NetworkIOException
- if the Apple servers aren't reachable
or the service cannot send notifications for nowCopyright © 2015. All rights reserved.