# Display push notifications in status & notification bar

**URL:** <https://forum.ionicframework.com/t/display-push-notifications-in-status-notification-bar/18565>\
**Category:** ionic-v1\
**Created:** [March 4, 2015, 8:40am UTC](https://forum.ionicframework.com/t/display-push-notifications-in-status-notification-bar/18565 "2015-03-04T08:40:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rameaume](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rameaume](https://forum.ionicframework.com/u/rameaume)\
**Post date:** [March 4, 2015, 8:40am UTC](https://forum.ionicframework.com/t/display-push-notifications-in-status-notification-bar/18565/1 "2015-03-04T08:40:04Z")

</div>

Hi !

I’m currently building an app with Ionic that required Push Notification. I use this [https://github.com/hollyschinsky/PushNotificationSample](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](https://global.discourse-cdn.com/ionicframework/original/2X/d/db0b71a91d226eddb7bbd3015299d62a4364869d.png)  
and here :  
 ![image](https://global.discourse-cdn.com/ionicframework/original/2X/3/36f8b4e1589e124aa6da653fb075912d90661dbe.png)

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

What do I miss ?  
Thanks for your help.

---

<div class="post-metadata">

**Author:** ![ysrael](https://avatars.discourse-cdn.com/v4/letter/y/ea5d25/32.png) [@ysrael](https://forum.ionicframework.com/u/ysrael)\
**Post date:** [March 4, 2015, 8:53am UTC](https://forum.ionicframework.com/t/display-push-notifications-in-status-notification-bar/18565/2 "2015-03-04T08:53:58Z")

</div>

Use local notifications

[http://devdactic.com/local-notifications-ionic/](http://devdactic.com/local-notifications-ionic/)

---

<div class="post-metadata">

**Author:** ![rameaume](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rameaume](https://forum.ionicframework.com/u/rameaume)\
**Post date:** [March 4, 2015, 2:50pm UTC](https://forum.ionicframework.com/t/display-push-notifications-in-status-notification-bar/18565/3 "2015-03-04T14:50:26Z")

</div>

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](http://forum.ionicframework.com/t/cordova-push-cordovapush-is-undefined-for-get-method/17432/8)

```
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](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 ?
