* @throws APNException
*/
public static void sendNotifications() throws APNException
{
// Create the service.
APNService service = new APNService();
service.initConnexion("<path to cert.p12>", "<password>", "PKCS12");
// Create a simple notification.
APNMessage msgA = new APNMessage("Alert message", 1, "default");
System.out.println(msgA);
// Send the notification
service.sendAPN("<my device token>", msgA);
// Increments the badge value.
msgA.incrementBadge(2);
// Send the notification
service.sendAPN("<my device token>", msgA);
// Create a complexe notification.
APNMessage msgB = new APNMessage();
APNMessage.CustomAlert customAlert = new APNMessage.CustomAlert();
customAlert.setBody("Another message");
customAlert.setLocalizedActionKey("play");
customAlert.setLocalizedMessageKey("message1.key");
customAlert.setLocalizedMessageArguments("John", "Mary", "1");
msgB.setCustomAlert(customAlert);
System.out.println(msgB);
// Send the notification.
service.sendAPN("<my device token>", msgB);
service.endConnection();
}