public class PushedNotification extends Object
An object representing the result of a push notification to a specific payload to a single device.
If any error occurred while trying to push the notification, an exception is attached.
If Apple's Push Notification Service returned an error-response packet, it is linked to the related PushedNotification so you can find out what the actual error was.
| Modifier | Constructor and Description |
|---|---|
protected |
PushedNotification(Device device,
Payload payload) |
|
PushedNotification(Device device,
Payload payload,
Exception exception) |
| Modifier and Type | Method and Description |
|---|---|
static List<PushedNotification> |
findFailedNotifications(List<PushedNotification> notifications)
Filters a list of pushed notifications and returns only the ones that failed.
|
static List<PushedNotification> |
findSuccessfulNotifications(List<PushedNotification> notifications)
Filters a list of pushed notifications and returns only the ones that were successful.
|
Device |
getDevice()
Returns the device that the payload was pushed to.
|
Exception |
getException()
Get the exception that occurred while trying to push this notification, if any.
|
long |
getExpiry()
Returns the expiration date of the push notification.
|
int |
getIdentifier()
Returns the connection-unique identifier referred to by
error-response packets.
|
String |
getLatestTransmissionAttempt()
Returns a human-friendly description of the number of attempts made to transmit the notification.
|
Payload |
getPayload()
Returns the payload that was pushed.
|
ResponsePacket |
getResponse()
If a response packet regarding this notification was received,
this method returns it.
|
int |
getTransmissionAttempts()
Returns the number of attempts that have been made to transmit the notification.
|
boolean |
isSuccessful()
Returns true if no response packet was received for this notification,
or if one was received but is not an error-response (ie command 8),
or if one was received but its status is 0 (no error occurred).
|
boolean |
isTransmissionCompleted()
Indicates if the notification has been streamed successfully to Apple's server.
|
protected void |
setDevice(Device device) |
protected void |
setPayload(Payload payload) |
String |
toString()
Returns a human-friendly description of this pushed notification.
|
public static List<PushedNotification> findSuccessfulNotifications(List<PushedNotification> notifications)
notifications - a list of pushed notificationspublic static List<PushedNotification> findFailedNotifications(List<PushedNotification> notifications)
notifications - a list of pushed notificationspublic Payload getPayload()
protected void setPayload(Payload payload)
public Device getDevice()
protected void setDevice(Device device)
public int getIdentifier()
public long getExpiry()
public int getTransmissionAttempts()
public String getLatestTransmissionAttempt()
public boolean isTransmissionCompleted()
public ResponsePacket getResponse()
public boolean isSuccessful()
Returns true if no response packet was received for this notification, or if one was received but is not an error-response (ie command 8), or if one was received but its status is 0 (no error occurred).
Returns false if an error-response packet is attached and has a non-zero status code.
Returns false if an exception is attached.
Make sure you use the Feedback Service to cleanup your list of invalid device tokens, as Apple's documentation says.
public String toString()
public Exception getException()
Copyright © 2016. All rights reserved.