notnoop/java-apns — Issue #60: Expiry date does not seem to work
Author: vtim
Created: 2011-11-14 12:03:36+00:00
State: open

I am trying to send a push notification with an expiry date. If the notification is not delivered within 2 hours (because device is in Airplane mode, has no connection, ...), it should be discarded.
This is what I have been trying, without luck:

```java
Date now = new Date();
Date expiryDate = new Date(now.getTime() + (1000 * 60 * 60 * 2));
apnsService.push("thedevicetoken", payload, expiryDate);
```

When sending the notification with ```expiryDate```, it's only delivered if the device is online at that time.
If I put my device in Airplane mode before pushing, and then immediately switch off Airplane mode, I never get the notification.

I would expect that if I turn off Airplane mode before ```expiryDate``` has elapsed, I would then receive the notification.

Am I doing something wrong, or is this a bug?