0
我正在實施android推送通知。我可以使用Intel XDK創建cordova/phonegap應用程序並在GCM上進行所有設置。我可以看到我的應用程序顯示註冊ID,當我安裝應用程序和故事是平穩的,直到這。無法將GCM註冊ID發送到應用程序服務器
現在我想將註冊ID發送到我託管的應用程序服務器。我已經寫了其餘的api,可以接收get並保存註冊ID。現在的問題是,當我在index.js的onNotificationGCM中添加Restful調用時,apk安裝會顯示錯誤「解析軟件包時出現問題」。請找我的電話onNotificationGCM代碼
onNotificationGCM: function(e) {
switch(e.event)
{
case 'registered':
if (e.regid.length > 0)
{
var req = new XMLHttpRequest();
var url = "http://XXXX.com/mycloudapp/register?regid="+e.regid;
console.log("Regid " +url);
req.open("GET", url, true);
console.log("After req.open");
req.send();
console.log("after send");
alert('registration id = '+e.regid);
}
break;
case 'message':
// this is the actual push notification. its format depends on the data model from the push server
alert('message = '+e.message+' msgcnt = '+e.msgcnt);
break;
case 'error':
alert('GCM error = '+e.msg);
break;
default:
alert('An unknown GCM event has occurred');
break;
}
}
,如果我從上面取出下面的代碼,它再次工作正常
req.open("GET", url, true);
console.log("After req.open");
req.send();
你的幫助是非常感謝!!!!