private static void pushAlert_test(Payload data, String keystore, String password, String uid) { try { logger.info("[IOSPUSH] push for dev"); // true: product // false: dev Push.payload(data, keystore, password, false, uid); } catch (CommunicationException e) { e.printStackTrace(); } catch (KeystoreException e) { e.printStackTrace(); } }
public void post() { TradingRecordVO trv = new TradingRecordVO(); trv.setPost(1); // 查询没有发送过的新销售记录 trv.setDate(null); List<TradingRecord> trList = tradingRecordService.findAll(trv); for (TradingRecord tr : trList) { // 更新数据库状态 tradingRecordService.updatePost(tr); try { payload.addCustomAlertBody(alertBody(tr)); payload.addSound("default"); payload.addBadge(10); Push.payload(payload, filePath, "2w3e4r5t", false, tk); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }