Releases: jpush/jpush-api-java-client
Releases · jpush/jpush-api-java-client
修复 GroupPush 返回结果为 0 bug
Change Log
- 修复
sendGroupPush
返回结果为 0 bug
新增接口
Change Log
- 新增 getMessagesStatus 接口,根据 msgId 和 registrationId 查询当天的消息状态。返回的 status 值为 0-4 整型。分别表示:
0 送达
1 未送达
2 用户不属于该 app
3 用户属于该 app,但不属于该 msgid
4 系统异常
使用方式:public static void testGetMessageStatus() { JPushClient jPushClient = new JPushClient(masterSecret, appKey); CheckMessagePayload payload = CheckMessagePayload.newBuilder() .setMsgId(3993287034L) .addRegistrationIds(REGISTRATION_ID1, REGISTRATION_ID2, REGISTRATION_ID3) .setDate("2017-08-08") .build(); try { Map<String, MessageStatus> map = jPushClient.getMessageStatus(payload); for (Map.Entry<String, MessageStatus> entry : map.entrySet()) { LOG.info("registrationId: " + entry.getKey() + " status: " + entry.getValue().getStatus()); } } catch (APIConnectionException e) { LOG.error("Connection error. Should retry later. ", e); } catch (APIRequestException e) { LOG.error("Error response from JPush server. Should review and fix it. ", e); LOG.info("HTTP Status: " + e.getStatus()); LOG.info("Error Code: " + e.getErrorCode()); LOG.info("Error Message: " + e.getErrorMessage()); } }
新增 API & 修复 Bug
Change Log
新增 API:
- sendGroupPush 发送分组推送
- getCidList 获得 cid
新增字段
- PushPayload 新增 cid 字段
- AudienceType 新增 abtest
修复 bug
修复 Message 中 addExtras 接口,如果传入的 Map 的元素有空值,toJSON 报空指针异常。
v3.2.19 新功能
更新日志
- 增加 tag_not 字段,详情请参考文档
- 使用 jiguang-common v1.0.6
v3.2.18 新功能
改动日志
- 安卓通知增加新字段:alert_type,参考文档
Change Log
- Android notification add field: alert_type, please refer our documents
v3.2.17 新功能
Change Log
- PushClient 增加 setHttpClient 方法,用户可以切换 NettyHttpClient 或 NativeHttpClient 来发送请求。
代码示例:
public static void testSendPush() {
// HttpProxy proxy = new HttpProxy("localhost", 3128);
// Can use this https proxy: https://github.com/Exa-Networks/exaproxy
ClientConfig clientConfig = ClientConfig.getInstance();
JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY, null, clientConfig);
String authCode = ServiceHelper.getBasicAuthorization(APP_KEY, MASTER_SECRET);
// Here you can use NativeHttpClient or NettyHttpClient.
NativeHttpClient httpClient = new NativeHttpClient(authCode, null, clientConfig);
// Call setHttpClient to set httpClient,
// If you don't invoke this method, default httpClient will use NativeHttpClient.
jpushClient.getPushClient().setHttpClient(httpClient);
// For push, all you need do is to build PushPayload object.
PushPayload payload = buildPushObject_all_alias_alert();
try {
PushResult result = jpushClient.sendPush(payload);
LOG.info("Got result - " + result);
// 如果使用 NettyHttpClient,需要手动调用 close 方法退出进程
// If uses NettyHttpClient, call close when finished sending request, otherwise process will not exit.
// jpushClient.close();
} catch (APIConnectionException e) {
LOG.error("Connection error. Should retry later. ", e);
LOG.error("Sendno: " + payload.getSendno());
} catch (APIRequestException e) {
LOG.error("Error response from JPush server. Should review and fix it. ", e);
LOG.info("HTTP Status: " + e.getStatus());
LOG.info("Error Code: " + e.getErrorCode());
LOG.info("Error Message: " + e.getErrorMessage());
LOG.info("Msg ID: " + e.getMsgId());
LOG.error("Sendno: " + payload.getSendno());
}
}
v3.2.16 修复 bug
Change Log
- 默认使用 NativeHttpClient 发送请求,如果请求量很大,高并发,请切换到 NettyHttpClient(Clone 代码,然后在 PushClient 等 client 中,将实例化 NativeHttpClient 的地方改为 NettyHttpClient,并且发送完毕后,手动调用 close 方法,目前 close 方法在 PushClient 及 JPushClient 中被注释掉了,去掉注释,然后打包即可)
- 使用 jiguang-common-v1.0.2
- 修改部分测试用例
v3.2.15 新功能
New Feature
- 支持 Android 新的通知特性,详情请查看文档
- 使用 jiguang-common-v1.0.1, 增加了 NettyHttpClient,用以解决多线程超时问题。
v3.2.11 新功能
- iOS 相关 Notification API 增加字段 mutable-content 及 subtitle 以适配 iOS10 新特性
- 新增 InterfaceAdapter,通过 gson.fromJson 可以将 JSON 字符串转换为 PushPayload 实例(参考 PushExample )
- 使用 jiguang-common-v0.1.6
v3.2.10 - 使用 jiguang-common 依赖
统一使用 jiguang-common 依赖