All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.togocms.pns.api.IOSNotification Maven / Gradle / Ivy

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