Skip to content

Releases: jpush/jpush-api-java-client

修复 GroupPush 返回结果为 0 bug

22 Nov 08:02
Compare
Choose a tag to compare

Change Log

  • 修复 sendGroupPush 返回结果为 0 bug

新增接口

07 Sep 02:11
Compare
Choose a tag to compare

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

05 Jul 09:18
Compare
Choose a tag to compare

Change Log

新增 API:

  • sendGroupPush 发送分组推送
  • getCidList 获得 cid

新增字段

  • PushPayload 新增 cid 字段
  • AudienceType 新增 abtest

修复 bug

修复 Message 中 addExtras 接口,如果传入的 Map 的元素有空值,toJSON 报空指针异常。

v3.2.19 新功能

16 May 03:27
Compare
Choose a tag to compare

更新日志

  • 增加 tag_not 字段,详情请参考文档
  • 使用 jiguang-common v1.0.6

v3.2.18 新功能

06 Apr 07:33
Compare
Choose a tag to compare

改动日志

Change Log

v3.2.17 新功能

06 Mar 09:11
Compare
Choose a tag to compare

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

17 Jan 07:07
Compare
Choose a tag to compare

Change Log

  • 默认使用 NativeHttpClient 发送请求,如果请求量很大,高并发,请切换到 NettyHttpClient(Clone 代码,然后在 PushClient 等 client 中,将实例化 NativeHttpClient 的地方改为 NettyHttpClient,并且发送完毕后,手动调用 close 方法,目前 close 方法在 PushClient 及 JPushClient 中被注释掉了,去掉注释,然后打包即可)
  • 使用 jiguang-common-v1.0.2
  • 修改部分测试用例

v3.2.15 新功能

27 Dec 04:00
Compare
Choose a tag to compare

New Feature

v3.2.11 新功能

26 Oct 08:17
Compare
Choose a tag to compare
  • iOS 相关 Notification API 增加字段 mutable-content 及 subtitle 以适配 iOS10 新特性
  • 新增 InterfaceAdapter,通过 gson.fromJson 可以将 JSON 字符串转换为 PushPayload 实例(参考 PushExample )
  • 使用 jiguang-common-v0.1.6

v3.2.10 - 使用 jiguang-common 依赖

05 Jul 08:18
Compare
Choose a tag to compare

统一使用 jiguang-common 依赖