Skip to content

新增接口

Compare
Choose a tag to compare
@KenChoi1992 KenChoi1992 released this 07 Sep 02:11
· 231 commits to master since this release

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