「产品更新」jpush-api-java-client v3.3.1 发布

sdk_java
jpush
标签: #<Tag:0x00007fb8480df928> #<Tag:0x00007fb8480df0e0>

(KenChoi) #1

jpush-api-java-client v3.3.1

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());
          }
      }