| | |
| | | public static String allPushIOS(List<String> deviceTokenList, MessageInfo info, String url, int type)
|
| | | throws Exception {
|
| | |
|
| | | if (Constant.IS_TEST)
|
| | | return null;
|
| | |
|
| | | Gson gson = new Gson();
|
| | | PushLogHelper.iosInfo("IOS推送设备数为:" + deviceTokenList.size());
|
| | | PushLogHelper.iosInfo("IOS推送的内容为:" + gson.toJson(info));
|
| | |
| | | int end = start + pageSize;
|
| | | if (end > tokenList.size())
|
| | | end = tokenList.size();
|
| | | pushIOS(tokenList.subList(start, end), json,certificate,certificatePassword);
|
| | | pushIOS(tokenList.subList(start, end), json, certificate, certificatePassword);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static String pushIOS(List<String> deviceTokenList, JSONObject json,InputStream certificate,String certificatePWD) throws Exception {
|
| | | public static String pushIOS(List<String> deviceTokenList, JSONObject json, InputStream certificate,
|
| | | String certificatePWD) throws Exception {
|
| | | List<String> tokenList = new ArrayList<String>();
|
| | | for (String deviceToken : deviceTokenList) {
|
| | | tokenList.add(deviceToken);
|
| | |
| | | PushNotificationManager pushManager = new PushNotificationManager();
|
| | | // true:表示的是产品线上发布推送服务 false:表示的是产品测试推送服务
|
| | | if (Constant.IS_TEST)
|
| | | pushManager.initializeConnection(
|
| | | new AppleNotificationServerBasicImpl(certificate, certificatePWD, false));
|
| | | pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, false));
|
| | | else
|
| | | pushManager
|
| | | .initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, true));
|
| | | pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, true));
|
| | |
|
| | | List<Device> deviceList = new ArrayList<Device>();
|
| | | for (String token : tokenList) {
|
| | |
| | | InputStream certificate = IOSPushUtil.class.getClassLoader()
|
| | | .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件
|
| | | String certificatePassword = Constant.systemCommonConfig.getIosPushCertificatePwd();
|
| | | pushIOS(tokenList, json,certificate,certificatePassword);
|
| | | pushIOS(tokenList, json, certificate, certificatePassword);
|
| | | }
|
| | |
|
| | | /**
|