javapns-jdk16
javapns-jdk16 copied to clipboard
我是这样写的,但是推送感觉有点慢。
import javapns.Push; import javapns.notification.PushNotificationBigPayload;
public class CopyOfMain { /** [email protected] / / APNs Server Host / private static final String HOST = "gateway.sandbox.push.apple.com"; / APNs Port */ private static final int PORT = 2195;
public static void sendNotification() {
try {
String p12FilePath = "dev4Push.p12";
String p12Password = "123654";
String tokenArray = "6e6d1850eeb233d65595471e783155458ce8c5c0a802bfd1dee0721cc1c1d166";
PushNotificationBigPayload payload = PushNotificationBigPayload.complex();
payload.addSound("default");
payload.addBadge(9);
payload.setMutableContent(true);
payload.setContentAvailable(true);
payload.addCustomAlertTitle("最美壁纸");
payload.addCustomAlertSubtitle("周杰伦新歌");
payload.addCustomAlertBody("这个是一张周杰伦的美照,喜欢吗");
payload.addCustomDictionary("mutable-content", "1");
payload.addCustomDictionary("image", "https://img1.doubanio.com/img/musician/large/22817.jpg");
payload.addCustomDictionary("url", "http://www. baidu.com/?tp=4");
payload.addCustomDictionary("id", "1007");
Push.payload(payload, p12FilePath, p12Password, false, tokenArray);
System.out.print("推送成功");
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
try
{
CopyOfMain.sendNotification();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Sorry, can you please explain your issue?