Ionic push notification callback when app is in background

I am using $cordovaPushV5.Notifications are working fine.But i want to call a function when a notification is received.I am using

$rootScope.$on('$cordovaPushV5:notificationReceived', function(event, notification){ 
 console.log("notification received")

This works fine when app is in foreground.but when app goes background i am not get that log.How to call some function when a push notification is received and app is in background ??? Thanks in advance

1 Like