JPush极光推送服务器端API
2017-07-16 23:35
519 查看
jpush初始化:
1、对android和ios设备发送
JPushClient jpush = new JPushClient(masterSecret, appKey);
2、对android和ios设备发送,同时指定离线消息保存时间
JPushClient jpush = new JPushClient(masterSecret, appKey, timeToLive);
3、指定某种设备发送
JPushClient jpush = new JPushClient(masterSecret, appKey, DeviceEnum.Android);
4、指定某种设备发送,同时指定离线消息保存时间
JPushClient jpush = new JPushClient(masterSecret, appKey, timeToLive, DeviceEnum.IOS);
参数说明:
发送消息:
代码示例:
1、发送带IMEI的通知
JPushClient jpush = new JPushClient(masterSecret, appKey); //jpush.setEnableSSL(true); int sendNo = 1; String imei = ""; String msgTitle = ""; String msgContent = ""; MessageResult msgResult = jpush.sendNotificationWithImei(sendNo, imei, msgTitle, msgContent); if (null != msgResult) { if (msgResult.getErrcode() == ErrorCodeEnum.NOERROR.value()) { System.out.println("发送成功, sendNo=" + msgResult.getSendno()); } else { System.out.println("发送失败, 错误代码=" + msgResult.getErrcode() + ", 错误消息=" + msgResult.getErrmsg()); } } else { System.out.println("无法获取数据"); }
2、IOS设置通知铃声及badge
JPushClient jpush = new JPushClient(masterSecret, appKey); Map<String, Object> extra = new HashMap<String, Object>(); IOSExtra iosExtra = new IOSExtra(1, "Windows_Logon_Sound.wav");//badge and sound extra.put("ios", iosExtra); MessageResult msgResult = jpush.sendNotificationWithAppKey(sendNo, msgTitle, msgContent, 0, extra);
相关文章推荐
- JPush极光推送 Java调用服务器端API开发
- JPush极光推送 Java调用服务器端API开发
- JPush极光推送 Java调用服务器端API开发
- JPush极光推送Java服务器端API
- JPush极光推送 Java调用服务器端API开发
- JPush极光推送Java服务器端API
- JPush极光推送Java服务器端API
- JPush极光推送Java服务器端API
- JPush极光推送Java服务器端API
- java服务器端调用JPush极光推送api推送通知消息
- JPush极光推送Java服务器端API
- java服务器端调用JPush极光推送api推送通知消息
- JPush极光推送Java服务器端API
- JPush极光推送 Java调用服务器端API开发
- JPush极光推送Java服务器端API
- JPush极光推送 Java调用服务器端API开发
- 极光推送---JPush---服务器端和android端怎么做
- 极光推送Jpush之RestAPI使用实例
- java远程调用JPush极光推送api
- 极光推送JPush客户端与服务器端的集成