|
本帖最后由 gzcyp2000 于 2015-10-26 17:51 编辑
打andriod包安装后,可以接收从jpush的控制台发出的通知消息(自定义消息收不到)。但按外卖案例做的APP推送消息不成功(直接调用外卖所用的servlet),不知道是什么原因造成的,还有别的需要设置的吗?
js源码如下:
define(function(require){
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
var Baas = require("$UI/demo/baas/baas");
var CommonUtils = require("$UI/system/components/justep/common/utils");
var jpushInstance = require("./jpush");
require("$UI/system/lib/cordova/cordova");
require("cordova!org.apache.cordova.device");
require("cordova!com.justep.cordova.plugin.weixin.v3");
require("cordova!com.justep.cordova.plugin.alipay");
require("cordova!org.apache.cordova.geolocation");
require("cordova!com.justep.cordova.plugin.baidulocation");
require("cordova!cn.jpush.phonegap.JPushPlugin");
var Model = function(){
this.callParent();
};
Model.prototype.button1Click = function(event){
alert("开始推送");
this.sendOrderPushMessage();
};
Model.prototype.sendOrderPushMessage = function() { //发送极光推送消息
jpushInstance.getRegistrationID().done(function(id) {
alert(id);
$.ajax({
method : "post",
url : "/baas/jpush/push",
data : {
'registrationId' : id,
'appKey' : "f4fa77eff85aea0cf631817a",
'masterSecret' : "25b49197dbf86dd63da1afa8"
}
});
});
};
return Model;
});
================================================
jpush.config.xml设置如下:
<config>
<!-- 配置成自己申请的JPush应用的参数 -->
<appKey>f4fa77eff85aea0cf631817a</appKey>
<masterSecret>25b49197dbf86dd63da1afa8</masterSecret>
<apnsProduction>false</apnsProduction>
</config>
================================================
控制台错误提示如下:
[17:39:59|INFO |(com.justep.jpush.JPushServlet)]=[registrationId:0305e43a79e, key: f4fa77eff85aea0cf631817a, masterSecret: 25b49197dbf86dd63da1afa8]
===================》已到达sendPushMessage, registrationId: 0305e43a79e, key: f4fa77eff85aea0cf631817a
[http-8080-1] INFO cn.jpush.api.common.connection.NativeHttpClient - Created instance with _maxRetryTimes = 3
[http-8080-1] INFO cn.jpush.api.common.connection.NativeHttpClient - Created instance with _maxRetryTimes = 3
[http-8080-1] INFO cn.jpush.api.common.connection.NativeHttpClient - Created instance with _maxRetryTimes = 3
[http-8080-1] INFO cn.jpush.api.common.connection.NativeHttpClient - Created instance with _maxRetryTimes = 3
[17:39:59|INFO |(com.justep.jpush.JPushServlet)]=[apnsProduction:true]
十月 26, 2015 5:40:00 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jpush threw exception
java.lang.RuntimeException: {}
at com.justep.jpush.JPushServlet.service(JPushServlet.java:73)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)
Caused by: {}
at cn.jpush.api.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:232)
at cn.jpush.api.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:94)
at cn.jpush.api.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:81)
at cn.jpush.api.schedule.ScheduleClient.createSchedule(ScheduleClient.java:58)
at cn.jpush.api.JPushClient.createSingleSchedule(JPushClient.java:433)
at com.justep.jpush.JPushServlet.sendPushMessage(JPushServlet.java:96)
at com.justep.jpush.JPushServlet.service(JPushServlet.java:67)
... 13 more
[http-8080-1] WARN cn.jpush.api.common.connection.NativeHttpClient - Got error response - responseCode:400, responseContent:{"error":{"message":"trigger->single->time[2015-10-26 17:40:59] is invalid, it has been expired now.","code":8100}}
[http-8080-1] ERROR cn.jpush.api.common.connection.NativeHttpClient - Your request params is invalid. Please check them according to error message.
{}
at cn.jpush.api.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:232)
at cn.jpush.api.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:94)
at cn.jpush.api.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:81)
at cn.jpush.api.schedule.ScheduleClient.createSchedule(ScheduleClient.java:58)
at cn.jpush.api.JPushClient.createSingleSchedule(JPushClient.java:433)
at com.justep.jpush.JPushServlet.sendPushMessage(JPushServlet.java:96)
at com.justep.jpush.JPushServlet.service(JPushServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)
|
|