Android Can';无法从gcm服务器获取注册表
几天前,我成功地用推送插件给手机发了信息。但是现在,在执行了Android Can';无法从gcm服务器获取注册表,android,cordova,phonegap-pushplugin,Android,Cordova,Phonegap Pushplugin,几天前,我成功地用推送插件给手机发了信息。但是现在,在执行了pushNotification.register之后,我没有收到具有注册ID的通知(在pushNotification.register之后,ecb没有被触发)。但成功处理者被解雇了。奇怪的是,当我关闭所有网络(Wifi、移动互联网)时,success handler也会被解雇。 所以我在另一个电话(朋友的)上试了一下。那么它工作得很好 我的手机怎么了?我最近几天搜索了这个问题,但没有找到任何有用的文档。有没有人有同样的问题
pushNotification.register
之后,我没有收到具有注册ID的通知(在pushNotification.register
之后,ecb没有被触发)。但成功处理者被解雇了。奇怪的是,当我关闭所有网络(Wifi、移动互联网)时,success handler也会被解雇。
所以我在另一个电话(朋友的)上试了一下。那么它工作得很好
我的手机怎么了?我最近几天搜索了这个问题,但没有找到任何有用的文档。有没有人有同样的问题
var pushNotification;
document.addEventListener("deviceready", function(){
pushNotification=window.plugins.pushNotification;
console.log('Device Ready!!');
register();
});
function register() {
console.log('registering...');
pushNotification.register(
successHandler,
errorHandler,
{
"senderID":"1234567890", // (temporary)
"ecb":"onNotification"
}
);
}
function onNotification(e) {
console.log('======onNotification======');
console.log('type of notification:'+e.event);
switch(e.event) {
case 'registered':
if(e.regid.length>0) {
$("#status").append('<li>regid:'+e.regid+'</li>');
console.log('regid:'+e.regid);
}
break;
case 'message':
if(e.foreground) {
console.log('inline message');
} else {
if(e.coldstart) {
console.log('coldstart message');
} else {
console.log('background message');
}
}
console.log('message:'+e.payload.message);
console.log('msgcnt:'+e.payload.msgcnt);
break;
case 'error':
$("#status").append('<li>error:'+e.msg);
break;
}
}
function successHandler(result) {
console.log('success; result:'+result);
}
function errorHandler(error) {
console.log('error; error:'+error);
}
var通知;
document.addEventListener(“deviceready”,函数(){
pushNotification=window.plugins.pushNotification;
log('deviceready!!');
寄存器();
});
函数寄存器(){
console.log('registing…');
pushNotification.register(
成功者,
错误处理程序,
{
“senderID”:“1234567890”,/(临时)
“ecb”:“通知”
}
);
}
通知功能(e){
console.log('===onNotification====');
console.log('通知类型:'+e.event);
开关(如事件){
“已登记”案件:
如果(e.区域长度>0){
$(“#status”).append(“regid:”+e.regid+” );
console.log('regid:'+e.regid);
}
打破
案例“信息”:
如果(如前景){
log(“内联消息”);
}否则{
如果(如coldstart){
console.log('coldstart消息');
}否则{
console.log(“后台消息”);
}
}
console.log('message:'+e.payload.message);
console.log('msgcnt:'+e.payload.msgcnt);
打破
案例“错误”:
$(“#status”).append(“错误:”+e.msg);
打破
}
}
函数successHandler(结果){
console.log('success;result:'+result);
}
函数errorHandler(错误){
log('错误;错误:'+错误);
}
我处于完全相同的位置。我已经尝试过重新启动我的手机,或者按照建议删除/重新安装我的应用程序,但到目前为止没有任何效果。同样的事情!!如果问题已解决,请添加您的答案。