当app在前台时,Android pushNotificationReceived事件未触发

时间:2015-01-07 20:35:49

标签: android ionic-framework cordova-plugins phonegap-pushplugin

我正在使用带有ngCordova的推送插件,并且当Android应用程序位于前台时,我没有触发任何pushNotificationReceived事件。当我进行设备注册时,事件会触发,它似乎也适用于iOS - 当应用程序位于前台时,它仅适用于Android。

当应用程序在后台时,我会毫无问题地获得标准推送通知横幅,但点击横幅也不会触发pushNotificationReceived。

angular.module('my.controllers', [])

  .controller('AppCtrl',function ($scope, $ionicModal, $state, $q, UserService, $cordovaPush) {
    $scope.$on('pushNotificationReceived', function (event, notification) {

      //this never gets called on Android if the message 
      //comes in the background through a notification 
      //this does however get triggered by the push registration event.
      alert('notification '+ JSON.stringify(notification));
    }
});

0 个答案:

没有答案