Hi !
I’m currently building an app with Ionic that required Push Notification. I use this https://github.com/hollyschinsky/PushNotificationSample as inspiration and PushWoosh for sending notifications to my device.
My app currently receives notifications only if the app is open :
This code is in a PushFactory :
onNotificationReceived : function(event, notification){
if (ionic.Platform.isAndroid()) {
this.handleAndroid(notification);
}
else if (ionic.Platform.isIOS()) {
this.handleIOS(notification);
}
},
handleAndroid : function(notification){
if (notification.event == 'registered') {
this.storeDeviceToken('and',notification.regid);
}
else if (notification.event == 'message') {
$cordovaDialogs.alert(notification.payload.title, "Push Notification Received");
}
else if (notification.event == 'error') {
$cordovaDialogs.alert(notification.msg, "Push notification error event");
} else {
$cordovaDialogs.alert(notification.event, "Push notification handler - Unprocessed Event");
}
},
And i got this in a global controller :
$scope.$on('pushNotificationReceived', function(event, notification) {
PushFactory.onNotificationReceived(event, notification);
});
That works well cause I got a CordovaDialog alert when I push a notification with pushwoosh
But now i want to display my notification in status bar and notification drawer :
here :
and here :
but I don’t figure out how to do it.
What do I miss ?
Thanks for your help.