4

I'm using the push plugin with ngCordova, and I'm not getting any pushNotificationReceived events firing when the Android app is in the foreground. The event fires when I do a device registration and it also seems to work for iOS - it's only on Android when the app is in foreground.

When the app is in the background, I get the standard push notification banners with no problem, but clicking through the banner doesn't trigger the pushNotificationReceived either.

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));
    }
});
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460

0 Answers0