2015-07-21 91 views
1

我试图从我的服务器向我的Android设备发送推送通知。使用插件PushNotification Cordova,我的代码是一些东西。用离子框架推送通知Android

 var androidConfig = { 
      "senderID": "inspired-berm-101218", 
     }; 

     document.addEventListener("deviceready", function(){ 
      $cordovaPush.register(androidConfig).then(function(result) { 
      // Success 
      }, function(err) { 
      // Error 
      }) 

      $rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) { 
      switch(notification.event) { 
       case 'registered': 
       if (notification.regid.length > 0) { 
        alert('registration ID = ' + notification.regid); 
        sessionService.set("token_device",notification.regid); 

根据我我的信息,我从这个论坛随后建议和教程是好的,是这些:

API密钥:AIzaSyDtZndyGvmWXF0TpYe83KVDgxRZ4MR3zK8

ID德尔PROYECTO:灵感 - 护堤-101218

Númerodel proyecto:805573676421

所有这些我使用我的应用程序和服务器是相同的代码,但然而,我收到错误:

{"multicast_id":7843752850335107662,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]} 

尝试卸载在我的手机上的应用程序并重新安装,但没有,这不适用于我。

+0

发件人ID是项目ID 805573676421因此改变你的'变种androidConfig = { “senderID”: “风情的护堤-101218”, };'到'VAR androidConfig = { “senderID” : “805573676421”, };' –

+0

我创建这个 https://medium.com/@ezeezegg/push-notification-con-ionic-para-android-81d99e91df42#.gmyimks5k 和一个项目,教程代码可在https://github.com/ezegg/ionic-push中找到 –

回答