Push notification 服务器和前端上的pushPlugin通知

Push notification 服务器和前端上的pushPlugin通知,push-notification,Push Notification,是否从包含消息的服务器再次触发此操作 "ecb":"window.onNotificationGCM" 我在服务器上设置了这个 device_tokens = [], //create array for storing device tokens retry_times = 4, //the number of times to retry sending the message if it failed sender = new gcm.Se

是否从包含消息的服务器再次触发此操作

"ecb":"window.onNotificationGCM"
我在服务器上设置了这个

device_tokens = [], //create array for storing device tokens
            retry_times = 4, //the number of times to retry sending the message if it failed
            sender = new gcm.Sender('AIzaSyDpA0b2smrKyDUSaP0Cmz9hz4cQ19Rxn7U'), //create a new sender
            message = new gcm.Message(); //create a new message

            message.addData('title', 'Open Circles');
            message.addData('message', req.query.message);
            message.addData('sound', 'notification');

            message.collapseKey = 'testing'; //grouping messages
            message.delayWhileIdle = true; //delay sending while receiving device is offline
            message.timeToLive = 3; //the number of seconds to keep the message on the server if the device is offline

            device_tokens.push(val.deviceToken);

            sender.send(message, device_tokens, retry_times, function(result){
                console.log(result);
                console.log('push sent to: ' + val.deviceToken);
            });
所以我想知道的是,一旦发出服务器调用,它是否会触发前端的通知。关于这个系统,我遗漏了什么

 case 'message':
      // if this flag is set, this notification happened while we were in  the foreground.
      // you might want to play a sound to get the user's attention, throw   up a dialog, etc.
      if (event.foreground) {
            console.log('INLINE NOTIFICATION');
            var my_media = new Media("/android_asset/www/" +          event.soundname);
            my_media.play();
      } else {
        if (event.coldstart) {
            console.log('COLDSTART NOTIFICATION');
        } else {
            console.log('BACKGROUND NOTIFICATION');
        }
      }

      navigator.notification.alert(event.payload.message);
      console.log('MESSAGE -> MSG: ' + event.payload.message);
      //Only works for GCM
      console.log('MESSAGE -> MSGCNT: ' + event.payload.msgcnt);
      //Only works on Amazon Fire OS
      console.log('MESSAGE -> TIME: ' + event.payload.timeStamp);
      break;

  case 'error':
      console.log('ERROR -> MSG:' + event.msg);
      break;

   default:
      console.log('EVENT -> Unknown, an event was received and we do not    know what it is');
      break;
}
};

 return {
register: function () {
  var q = $q.defer();
  if(ionic.Platform.isAndroid()){
    pushNotification.register(
        successHandler,
        errorHandler,
         {
            "senderID":"346007849782",
            "ecb":"window.onNotificationGCM"
         }
    );
  }else{
    pushNotification.register(
        tokenHandler,
        errorHandler,
         {
            "badge":"true",
            "sound":"true",
            "alert":"true",
            "ecb":"window.onNotificationAPN"
        }
    );
  }
  return q.promise;
}
}


更新。最终,我的服务器回吐出:TypeError:无法读取未定义的属性“processIncomingMessage”

似乎我的google ID不起作用。我创建了一个新的,现在它正在发送推送请求