Does ionic push with dev_push==true work with ionic serve?


from the tutorial, I see this note:

Now, on to that whole Push Notification thing.
Here be dragons.

Please note, from this point onward, any testing you do needs to be on a physical device. ionic serve and emulators can’t receive push notifications.

However, the prior note about dev_push says this:

A note on the dev_push flag:

You may have noticed the dev_push flag in the .config() above. This will enable your new app to use development pushes instead of going through GCM or APNS for its notifications.

These pushes work absolutely anywhere, from ionic serve to emulators to actual devices. While we can’t check the status of your GCM API key or APNS certificates and Provisioning Profile, we can let you test the service without using them.

So what gives? should it work with ionic serve?


No, unfortunately.

When you install your app on a device (emulator for dev or physical for production) THEN the app will have access to the push notification API system on there. Since serve only runs the web code in the browser, there is no OS to listen for push notifications.

There is no way around this since the code literally does not exist in the browser to test notifications. This is for any web development or app stuff. You should be really really really grateful they did the dev stuff, it’s so hard testing push notifications on an emulator by yourself. They made it amazingly easy!

But yeah that’s the answer for ya



After finishing the entire tutorial, including installing the certificates, I’ve discovered that you CAN get notifications from a browser session over ionic serve. They appear as browser alerts and you can only dismiss them.

So the part about the dragons is incorrect, you can still do some limited browser testing from ionic serve.