使用Java程序推送apns消息报错sslException?
程序代码:
import java.util.List;
import javapns.Push;
import javapns.notification.PushedNotification;
import javapns.notification.ResponsePacket;
public class Test1 {
public static void main(String[] args) {
String[] devices = {“2f48b73df95e878bd313622ffa0c7ec06d43571dcd7d658db1c355f5beb8433f”};
try {
List notifications = Push.alert(“Hello World!”,“push.p12”, “123123”, false, devices);
for (PushedNotification notification : notifications) {
if (notification.isSuccessful()) {
System.out.println("Push notification sent successfully to: " +
notification.getDevice().getToken());
} else {
String deviceToken = notification.getDevice().getToken();
System.out.println("deviceToken = " + deviceToken);
Exception theProblem = notification.getException();
theProblem.printStackTrace();
ResponsePacket theErrorResponse = notification.getResponse();
if (theErrorResponse != null) {
System.out.println(theErrorResponse.getMessage());
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
本文地址:https://blog.csdn.net/woshiniezepeng/article/details/107371238
如对本文有疑问, 点击进行留言回复!!
HashMap、Hashtable、ConcurrentHashMap三者间的异同
解决RecycleView 中Item包含Edittext时,滑动view复用导致数据错乱的问题
多线程、同步工作原理、死锁案例、Lock接口、线程的生命周期的讲解及实现
网友评论