# Push Notification notificationCallback working only once

**URL:** <https://forum.ionicframework.com/t/push-notification-notificationcallback-working-only-once/40986>\
**Category:** ionic-v1\
**Created:** [January 11, 2016, 7:18pm UTC](https://forum.ionicframework.com/t/push-notification-notificationcallback-working-only-once/40986 "2016-01-11T19:18:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kpsolutions](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kpsolutions](https://forum.ionicframework.com/u/kpsolutions)\
**Post date:** [January 11, 2016, 7:18pm UTC](https://forum.ionicframework.com/t/push-notification-notificationcallback-working-only-once/40986/1 "2016-01-11T19:18:15Z")

</div>

Hi,

I’ve managed to receive push notifications on my app following the [push from scratch tutorial](http://docs.ionic.io/docs/push-from-scratch)

However, something is really weird: the function I’ve defined as onNotification callback works only during the first run of the App. If I close the app, then opens it again, I DO get the notification, but I don’t get the function I’ve defined as callback being called.

This is my code (inside a login Controller):

[Ionic.io](http://Ionic.io)();  
new Ionic.Push({  
//“debug”: true,  
“onNotification”: function(notification) {  
alert(‘a’);  
},  
“onRegister”: function(data) {  
alert(‘b’);  
}  
});   
push.register();

I’ve already tried putting this code in the .run() function. Also no success… am I missing something here?

---

<div class="post-metadata">

**Author:** ![Smezer](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Smezer](https://forum.ionicframework.com/u/Smezer)\
**Post date:** [January 18, 2016, 11:28am UTC](https://forum.ionicframework.com/t/push-notification-notificationcallback-working-only-once/40986/2 "2016-01-18T11:28:34Z")

</div>

Hello, phonegap-plugin-push released a new version that may fix your problem ( it did for me ).  
check : [https://github.com/phonegap/phonegap-plugin-push/blob/master/CHANGELOG.md](https://github.com/phonegap/phonegap-plugin-push/blob/master/CHANGELOG.md)

( to update : cordova plugin add phonegap-plugin-push )

Put your onNotification, after your “pluginConfig” ( cf : [https://github.com/driftyco/ng-cordova/issues/963#issuecomment-152867351](https://github.com/driftyco/ng-cordova/issues/963#issuecomment-152867351) )

---

<div class="post-metadata">

**Author:** ![kpsolutions](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kpsolutions](https://forum.ionicframework.com/u/kpsolutions)\
**Post date:** [January 27, 2016, 6:32pm UTC](https://forum.ionicframework.com/t/push-notification-notificationcallback-working-only-once/40986/3 "2016-01-27T18:32:30Z")

</div>

Hi Smezer,

Thanks for the tip, it started working (with the same code). I guess it was indeed a bug.
