Push delivered but notification does not show

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 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?

Look at the examples here:


Do you have everything done here?

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?

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

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

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

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 :wink: Not that I just sent pushes to users that will get exactly this alert window the next time they open the app *ooops

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?

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.