Hi Everyone,
I have configured the ngcordova’s push notification plugin, and its working , i just need to understand few things.
While the application is closed, the notification pops up in the notification bar of the mobile. While i click the notification the application is opened normally , no sign of notification in the application so in the first controller on the application opening is write the following code
$rootScope.$on(‘pushNotificationReceived’, function(event, notification) {
console.log(4);
switch(notification.event) {
case 'registered':
if (notification.regid.length > 0 ) {
console.log(5);
alert('registration ID = ' + notification.regid);
console.log(notification.regid);
}
break;
case 'message':
// this is the actual push notification. its format depends on the data model from the push server
alert('message = ' + notification.message + ' msgCount = ' + notification.msgcnt);
break;
case 'error':
alert('GCM error = ' + notification.msg);
break;
default:
alert('An unknown GCM event has occurred');
break;
}
});
So for its ok, i got the notification and performed some actions, but what about if the application is already running and the notification comes, because the application is already running there is no controller loading, so how can i perform a refresh or something in the application?