使用JavaPns向APNs推送通知
2014-05-14 19:36
232 查看
以下只是服务器端的操作步骤:
1.下载JavaPNs的库文件JavaPNS_2.2.jar
2.下载Java依赖的jar bcprov-jdk15on-150.jar和log4j-1.2.17.jar
3,获得.p12文件和设备的Token值
4.测试类
public class TestMain {
public static void main(String[] args){
List<Device> devices=new ArrayList<Device>();
Device device = new BasicDevice();
device.setToken("");
devices.add(device);
Device device2 = new BasicDevice();
device2.setToken("");
devices.add(device2);
String message="1234567890!";
String keystore="D:/***.p12";(.p12文件的路径)
String password="";
try {
PushedNotifications notifications=Push.alert(message, keystore, password, false, devices);
PushedNotifications fails=notifications.getFailedNotifications();
PushedNotifications success=notifications.getSuccessfulNotifications();
System.out.println("fails :" + fails.isEmpty());
System.out.println("success:" +success.isEmpty());
} catch (CommunicationException e) {
e.printStackTrace();
} catch (KeystoreException e) {
e.printStackTrace();
}
}
}
1.下载JavaPNs的库文件JavaPNS_2.2.jar
2.下载Java依赖的jar bcprov-jdk15on-150.jar和log4j-1.2.17.jar
3,获得.p12文件和设备的Token值
4.测试类
public class TestMain {
public static void main(String[] args){
List<Device> devices=new ArrayList<Device>();
Device device = new BasicDevice();
device.setToken("");
devices.add(device);
Device device2 = new BasicDevice();
device2.setToken("");
devices.add(device2);
String message="1234567890!";
String keystore="D:/***.p12";(.p12文件的路径)
String password="";
try {
PushedNotifications notifications=Push.alert(message, keystore, password, false, devices);
PushedNotifications fails=notifications.getFailedNotifications();
PushedNotifications success=notifications.getSuccessfulNotifications();
System.out.println("fails :" + fails.isEmpty());
System.out.println("success:" +success.isEmpty());
} catch (CommunicationException e) {
e.printStackTrace();
} catch (KeystoreException e) {
e.printStackTrace();
}
}
}
相关文章推荐
- 无法使用 Apple 推送通知服务(APNs)
- Python搭建APNS苹果推送通知推送服务的相关模块使用指南
- JavaPns向APNS发送推送信息
- ZPush--基于netty4实现的苹果通知推送服务(APNs)Java客户端
- ZPush--基于netty4实现的苹果通知推送服务(APNs)Javaclient
- Python搭建APNS苹果推送通知推送服务的相关模块使用指南
- 在您的移动应用程序中使用推送通知、SMS和电子邮件的最佳做法
- 苹果推送通知服务(APNs)编程
- iphone 推送通知 java 实现
- iPhone应用中APNS推送通知流程代码实现案例
- 在您的移动应用程序中使用推送通知、SMS和电子邮件的最佳做法
- APNS推送通知的流程
- iphone 推送通知 服务器端java 实现
- APNS推送通知的流程
- APNS推送通知的流程
- 苹果推送通知服务(APNs)编程
- iphone 推送通知 java 实现
- APNS推送通知的流程
- APNS推送通知的流程
- APNS推送通知的流程