Display push notifications in status & notification bar

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 :
image
and here :
image

but I don’t figure out how to do it.

What do I miss ?
Thanks for your help.

Use local notifications

http://devdactic.com/local-notifications-ionic/

Thanks.
I was able to setup local notifications thanks to your link.

I now have a notification when I send one with Pushwoosh. It works well when the app is in foreground but I got nothing when the app is in background or closed.

I already setup in my config the ecb parameter thanks to this thread : Cordova Push - $cordovaPush is undefined for 'get' method

if (ionic.Platform.isAndroid()) {
    config = {
	     "senderID": gcm,
	     "ecb": "angular.element(document.body).injector().get('$cordovaPush').onNotification"
    };
}
else if (ionic.Platform.isIOS()) {
    config = {
	    "badge": "true",
	    "sound": "true",
            "alert": "true"
     }
}

I saw here : https://github.com/phonegap-build/PushPlugin/issues/212 that the plugin need a parameter “message” in the notification object receive and PushWoosh send this :

    { 
        event: "message", 
        from: "345999759778", 
        collapse_key: "do_not_collapse", 
        foreground: true, 
        payload: {
           p: "X",
           title: "my notification title",
           u: {
              message: "test message"
           }
        }
    }

Do you know how can I setup PushWoosh so i can have a “message” attribute in the received object ?