
com.togocms.pns.api.IOSNotification Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of togopns Show documentation
Show all versions of togopns Show documentation
Push Notification System (Apple/Google)
The newest version!
package com.togocms.pns.api;
import java.util.ArrayList;
import java.util.List;
import javapns.Push;
import javapns.devices.implementations.basic.BasicDevice;
import javapns.notification.PushNotificationPayload;
import javapns.notification.PushedNotification;
public class IOSNotification extends AbstractNotification {
public List send() throws Exception {
List devices = new ArrayList();
for (String token : getTokens()) {
devices.add(new BasicDevice(token));
}
PushNotificationPayload payload = PushNotificationPayload.complex();
payload.addAlert(getAlert());
List notifications = Push.payload(payload, getKeyStorePath(), getKeyStorePassword(), isProduction(), devices);
List badTokens = new ArrayList();
for (PushedNotification notification : notifications) {
if (!notification.isSuccessful()) {
badTokens.add(notification.getDevice().getToken());
}
}
return badTokens;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy