atitit.极光消息推送服务器端开发实现推送 jpush v3. 总结o7p
atitit.极光消息推送服务器端开发实现推送 jpush v3. 总结o7p
1. 推送所设计到底功能
1.1. 内容压缩
1.2. 多引擎
2. reg ,设置appkey and pwdkey
3. 下载server sdk v3
https://github.com/jpush/jpush-api-java-client
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
4. push推送样例
以下片断来自项目代码里的文件:cn.jpush.api.examples.PushExample
JPushClient jpushClient = new JPushClient(masterSecret, appKey, 3);
// For push, all you need do is to build PushPayload object.
PushPayload payload = buildPushObject_all_all_alert();
try {
PushResult result = jpushClient.sendPush(payload);
LOG.info("Got result - " + result);
} catch (APIConnectionException e) {
// Connection error, should retry later
LOG.error("Connection error, should retry later", e);
} catch (APIRequestException e) {
// Should review the error, and fix the request
LOG.error("Should review the error, and fix the request", e);
LOG.info("HTTP Status: " + e.getStatus());
LOG.info("Error Code: " + e.getErrorCode());
LOG.info("Error Message: " + e.getErrorMessage());
}
进行推送的关键在于构建一个 PushPayload 对象。以下示例一般的构建对象的用法。
5. Code
Pushx。Java
private static void single_test(final double i) throws APIConnectionException,
APIRequestException {
core.execMeth_Ays(new Runnable() {
@Override
public void run() {
String r = "";
try {
r = new pushX().push(".", 1099);
} catch (APIConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(String.valueOf(i) + "::" + r);
}
}, " threadName");
}
public String push(final String txt, final Object... target)
throws APIConnectionException, APIRequestException {
// attilax 老哇的爪子 X5042 o7m // k_56_44 o80 老哇的爪子 Attilax
core.log("---- o8q14 add act n seruinfo before txt:" + txt);
core.log("----add act n seruinfo before len:"
+ String.valueOf(txt.length()));
final String s = jpushCompressor.kmprs(txt);
core.log("----add act n seruinfo aft len:" + String.valueOf(s.length()));
logger.info(txt + "\r\ntarget:" + StringUtils.join(target, ",") + " ");
// new com.attilax.tryX<String>() {
// @Override public String $$(Object t) throws Exception {
// attilax 老哇的爪子 2_q_9 o86
setInvokeTimes();
try {
PushExample.SendPush_msgFmt(s, core.toStrArr(target));
} finally {
// this.respMsg=r;
this.sendMsg = PushExample.sendMsg_thrdloc.get();
}
// catch (APIConnectionException e) {
// respMsg="APIConnectionException";
// }
// catch (APIRequestException e) {
// respMsg=
// }
// return null;
// }
// }.$("");
new com.attilax.tryX<String>() {
@Override
public String $$(Object t) throws Exception {
// attilax 老哇的爪子 2_q_9 o86
// PushExample.SendPush(s, core.toStrArr(target));
return null;
}
}.$("");
String r = PushExample.rzt.get();
return r;
}
atitit.极光消息推送服务器端开发实现推送 jpush v3. 总结o7p的更多相关文章
- java服务端集成极光消息推送--详细开发步骤
1.极光推送账号准备 要使用极光消息推送必须先在官方网站上注册账号,并添加应用. 产品介绍:https://docs.jiguang.cn/jpush/guideline/intro/ 注册开发者账号 ...
- 最新的极光推送服务器端代码(java服务器后台向手机端自定义推送消息)
一共两个类 一个Jdpush 一个JpushClientUtil 代码如下 注解都写的很清楚 package com.sm.common.ajpush; import org.slf4j.Log ...
- 【Android应用开发】 推送原理解析 极光推送使用详解 (零基础精通推送)
作者 : octopus_truth 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/45046283 推送技术产生场景 : -- ...
- .NET对接极光消息推送
什么是APP消息推送? 很多手机APP会不定时的给用户推送消息,例如一些新闻APP会给用户推送用户可能感兴趣的新闻,或者APP有更新了,会给用户推送是否选择更新的消息等等,这就是所谓的"消息 ...
- iOS 极光推送 如何点击推送消息跳转页面
假如你已经集成完了极光,恰好有这个问题不知如何解决,可以看看这篇文章,这篇是针对远程通知的,本地通知大同小异吧. 根据我项目的要求,极光推送跳转指定页面分为两种情况:app在后台情况和app在杀死的情 ...
- iOS开发 iOS10推送必看(基础篇)
iOS10更新之后,推送也是做了一些小小的修改,下面我就给大家仔细说说.希望看完我的这篇文章,对大家有所帮助. 原文链接 一.简单入门篇---看完就可以简单适配完了相对简单的推送证书以及环境的 ...
- pushlet实现服务器端向客户端推送信息
使用Pushlet来实现服务器端向客户端推送信息 1. 实现方式: 有两种实现方式: 1. 通过配置文件来实现定时的从服务器端向客户端推送信息 2. 通过API主动 ...
- iOS开发 iOS10推送必看
iOS10更新之后,推送也是做了一些小小的修改,下面我就给大家仔细说说.希望看完我的这篇文章,对大家有所帮助. 一.简单入门篇---看完就可以简单适配完了 相对简单的推送证书以及环境的问题,我就不在这 ...
- 使用Pushlet来实现服务器端向客户端推送信息
使用Pushlet来实现服务器端向客户端推送信息 1. 实现方式: 有两种实现方式: 1. 通过配置文件来实现定时的从服务器端向客户端推送信息 2. 通过A ...
随机推荐
- tomcat安装规范
创建用户 useradd -u 501 tomcat passwd tomcat tomcat安装 tar zxf apache-tomcat-8.5.5.tar.gz -C /usr/local/ ...
- Android开机过程
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha Android开机过程 BootLoder引导,然后加载Linux内核. 0号进程ini ...
- java.net.MalformedURLException: Protocol not found:
出现java.net.MalformedURLException: Protocol not found: 一般来说是url地址没有写对.没有以http://开头,或者出现空格等格式问题: 要看清楚 ...
- 【分块】bzoj2724 [Violet 6]蒲公英
分块,离散化,预处理出: ①前i块中x出现的次数(差分): ②第i块到第j块中的众数是谁,出现了多少次. 询问的时候,对于整块的部分直接获得答案:对于零散的部分,暴力统计每个数出现的次数,加上差分的结 ...
- linux-内存使用-free
解释一下Linux上free命令的输出. 下面是free的运行结果,一共有4行.为了方便说明,我加上了列号.这样可以把free的输出看成一个二维数组FO(Free Output).例如: FO[2][ ...
- easyui中一键清空搜索栏搜索条件的思路
$.fn.clearAllSearchPanel = function () { var $id = $(this); $id.find(".form-control").each ...
- 面试题:判断两个字符串是否互为回环变位(Circular Rotaion)
题干: 如果字符串 s 中的字符循环移动任意位置之后能够得到另一个字符串 t,那么 s 就被称为 t 的回环变位(circular rotation). 例如,ACTGACG 就是 TGACG ...
- Yii2.0源码分析之——控制器文件分析(Controller.php)创建动作、执行动作
在Yii中,当请求一个Url的时候,首先在application中获取request信息,然后由request通过urlManager解析出route,再在Module中根据route来创建contr ...
- Hyper-V Tools for win7
http://download.microsoft.com/download/C/1/C/C1CA233D-CA1A-4C4D-8240-B4AFC0FD3433/Windows6.1-KB95883 ...
- docker集群——搭建Mesos+Zookeeper+Marathon的Docker管理平台
服务器架构 机器信息: 这里部属的机器为3个Master控制节点,3个slave运行节点,其中: zookeeper.Mesos-master.marathon运行在Master端:Mesos-sla ...