# Push delivered but notification does not show

**URL:** <https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809>\
**Category:** ionic-v1\
**Created:** [December 9, 2015, 8:36am UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809 "2015-12-09T08:36:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaurav0](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gaurav0/32/89039_2.png) [@gaurav0](https://forum.ionicframework.com/u/gaurav0)\
**Post date:** [December 9, 2015, 8:36am UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809/1 "2015-12-09T08:36:59Z")

</div>

I am not sure what I am doing wrong but I am certain this is a small silly mistake I have made.

I am using the [push plugin](https://github.com/phonegap/phonegap-plugin-push) from ngCordova. I am able to retrieve the plugin and then send the push token to my backend. When my backend sends a push I can see that my app receives it in the console but no notification is displayed.

Do I need to write extra logic to display a notification?

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [December 9, 2015, 11:27pm UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809/2 "2015-12-09T23:27:05Z")

</div>

Look at the examples here:

> <https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/EXAMPLES.md>

  
Do you have everything done here?

---

<div class="post-metadata">

**Author:** ![gaurav0](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gaurav0/32/89039_2.png) [@gaurav0](https://forum.ionicframework.com/u/gaurav0)\
**Post date:** [December 10, 2015, 3:58am UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809/3 "2015-12-10T03:58:05Z")

</div>

Yes, I have done everything in that example. The console even logs the push that is received but no notification.

Would you happen to know of an open source app that uses ionic and push that I can refer to?

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [December 10, 2015, 1:10pm UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809/4 "2015-12-10T13:10:09Z")

</div>

> [@gaurav0](#):
>
> The console even logs the push that is received but no notification.

Show us your onNotification code please.  
Who logs the push? How and by what code should it be handled?

---

<div class="post-metadata">

**Author:** ![gaurav0](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gaurav0/32/89039_2.png) [@gaurav0](https://forum.ionicframework.com/u/gaurav0)\
**Post date:** [December 10, 2015, 2:25pm UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809/5 "2015-12-10T14:25:40Z")

</div>

`push.on('notification', pushReceived); function pushReceived(data) { $log.debug('received push', data); }`

Thats pretty much it. The notification is logged but not shown.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [December 11, 2015, 11:52pm UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809/6 "2015-12-11T23:52:17Z")

</div>

Well, there is no code to show it!

The device and native OS only handles and shows pushes when the app is not open or in the background. When the app is in the foreground (and so can log an incoming push) you have to take care of that yourself!

Simplest example:

```
alert(data);

```

PS: Don’t use that in production, it makes for one ugly push notification display 😉 Not that I just sent pushes to users that will get exactly this alert window the next time they open the app \*ooops

---

<div class="post-metadata">

**Author:** ![gaurav0](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gaurav0/32/89039_2.png) [@gaurav0](https://forum.ionicframework.com/u/gaurav0)\
**Post date:** [December 14, 2015, 11:49am UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809/7 "2015-12-14T11:49:43Z")

</div>

Thanks for explaining that Sujan. How do I get my code to display a native push notification when the app is active then?

And if my app is in the background, will receiving a push automatically display a native notification?

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [December 14, 2015, 4:50pm UTC](https://forum.ionicframework.com/t/push-delivered-but-notification-does-not-show/38809/8 "2015-12-14T16:50:39Z")

</div>

> [@gaurav0](#):
>
> How do I get my code to display a native push notification when the app is active then?

You don’t as native push notifications only appear if the app is not active. Or what exactly do you mean? Do you have examples from other apps?[quote=“gaurav0, post:7, topic:38809”]  
And if my app is in the background, will receiving a push automatically display a native notification?  
[/quote]Yes, that’s how it works. Push → notification → if users taps on notification you app is opened and the notification can be handled.
