Package cn.jpush.api

Examples of cn.jpush.api.MessageResult


    Map<String, Object> extra = new HashMap<String, Object>();
    IOSExtra iosExtra = new IOSExtra(10, "WindowsLogonSound.wav");
    extra.put("ios", iosExtra);

    //对所有用户发送通知, 更多方法请参考文档
    MessageResult msgResult = jpush.sendCustomMessageWithAppKey(sendNo,msgTitle, msgContent);
    //MessageResult msgResult  = jpush.sendNotificationWithAlias(sendNo, "a", msgTitle, msgContent);

    //覆盖指定msgId的消息,msgId可以从msgResult.getMsgid()获取。
    //MessageResult msgResult = jpush.sendNotificationWithAppKey(sendNo, msgTitle, msgContent, 0, extra,msgResult.getMsgid());


    if (null != msgResult) {
      System.out.println("服务器返回数据: " + msgResult.toString());
      if (msgResult.getErrcode() == ErrorCodeEnum.NOERROR.value()) {
        System.out.println(String.format("发送成功, sendNo= %s,messageId= %s",msgResult.getSendno(),msgResult.getMsg_id()));
      } else {
        System.out.println("发送失败, 错误代码=" + msgResult.getErrcode() + ", 错误消息=" + msgResult.getErrmsg());
      }
    } else {
      System.out.println("无法获取数据");
    }
View Full Code Here


     * 通知、消息  两者区别。请参考:http://docs.jpush.cn/pages/viewpage.action?pageId=3309701
     */

   
    //对所有用户发送通知。
    MessageResult msgResult = jpush.sendNotificationWithAppKey(sendNo, msgTitle, msgContent);
   
    //对所有用户发送消息。
    //MessageResult msgResult = jpush.sendCustomMessageWithAppKey(sendNo,msgTitle, msgContent);
   
   
    //覆盖指定msgId的消息,msgId可以从msgResult.getMsgid()获取。
    //MessageResult msgResult = jpush.sendNotificationWithAppKey(sendNo, msgTitle, msgContent, 0, extra,msgResult.getMsgid());


    if (null != msgResult) {
      System.out.println("服务器返回数据: " + msgResult.toString());
      if (msgResult.getErrcode() == ErrorCodeEnum.NOERROR.value()) {
        System.out.println(String.format("发送成功, sendNo= %s,messageId= %s",msgResult.getSendno(),msgResult.getMsg_id()));
      } else {
        System.out.println("发送失败, 错误代码=" + msgResult.getErrcode() + ", 错误消息=" + msgResult.getErrmsg());
      }
    } else {
      System.out.println("无法获取数据");
    }

View Full Code Here

  private final int DEFAULT_SOCKET_TIMEOUT = (30 * 1000); // milliseconds

  private static Gson gson = new Gson();

  public MessageResult sendPush(final String path, final boolean enableSSL, final MessageParams messageParams) {
    MessageResult messageResult = ValidateRequestParams.vidateParams(messageParams);
    if(messageResult != null) return messageResult;

    String pushResult = sendPost(path, enableSSL, parse(messageParams),RequestTypeEnum.PUSH.value(),null);
    return gson.fromJson(pushResult, MessageResult.class);
  }
View Full Code Here

TOP

Related Classes of cn.jpush.api.MessageResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.