Simple Question: Can a device recive a push message when the app is not running (native push) with ionic push service?

Simple Question: Can a device recive a push message when the app is not running (native push) with ionic push service?

After setting the project to production mode (dev_push false, debug: false, ionic config set cgm_key etc.) I get this error when running the app at the point where I register:

On Android LogCat: ReferenceError: PushNotification is not defined …
On IOS console: ERROR: Ionic Push: PushNotification Plugin required. Have you run ionic phonegap-plugin-push?

Plugin list:
com.pushwoosh.plugins.pushwoosh 3.6.16 "Pushwoosh"
cordova-plugin-console 1.0.2 "Console"
cordova-plugin-device 1.1.0 "Device"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-file-transfer 1.4.0 "File Transfer"
cordova-plugin-geolocation 1.0.1 "Geolocation"
cordova-plugin-splashscreen 3.0.0 "Splashscreen"
cordova-plugin-sqlite 0.9.0 "Cordova Sqllite Plugine"
cordova-plugin-statusbar 2.0.0 "StatusBar"
cordova-plugin-whitelist 1.2.0 "Whitelist"
ionic-plugin-keyboard 1.0.8 “Keyboard”

Doesn’t Pushwoosh work with production mode?

No. Pushwoosh is an alternative offering to Ionic Push. You should use the recommended push plugin from Ionic Push. That’s exactly what the error message is telling you: “The plugin I need is not there. Please fix this.”

Allright then … I will use the phonegap-push-plugin. But the event handler “onRegister” doesn’t fire up after calling new Ionic.Push(...).register(...);

Allthough see:

EDIT: It fires up now!

It should only fire if the register is actually successful. So if you get a token, it also fires.

Okay … I was asking because I got no response nor fire of event handler the last two days. I was wondering why?


You get a token the first time, you save it, you’re done. No more firing, no more tokens - you use the one you got the first time.

Nope. After calling the .register-method an event handler “onRegister” should fire up. The param of that handler should be the pushToken.

No event firing … no pushToken. So I could have kept waiting for the event or … or asked here what’s going on :wink:

In Android everything works. For me in iOS, when the app is active, it works. When in the background - it works. When I shut-down the app - I don’t get any push notifications to my device. Anyone knows why??

You’re still in Debug mode. Prepare for native pushs (still coming from and everything will work. You’ll need to get some Tokens and Ids by the develop center of Apple and Google (for iOS and Android).

I didn’t understand your answer.
I don’t think I am in debug mode. I used ionic to upload the certificates…
How do I check if I’m in “debug” mode?

If you receive messages you configured everything (mostly) fine. If you ONLY receive messages when your app is running you are in debug mode. If you receive (native) messages when your app is not running you’ve all done what’s to do.

Umm … and sorry, it’s not called “debug mode” … it’s the development mode. Look:

Anyhow, I switched my server side to work directly with APNS + GCM and my client side to use the Cordova push plugin, and everything works well now…

My recommendation to the Ionic team -> After sending a push to servers, in the response message, say if it was a real push or a development push… That’s important for debugging and detecting errors…

1 Like

Awesome! Our customer didn’t wanted to use services in his app. So I switched to Pushwoosh. Customer again said to not use this service, too, because it’s “too expensive”. Now I’m struggling with the ngCordova Push Notifications Plugin, which is deprecated.
See …

The newer project on which is used for the web client could be build on iOS in the past. Now I get error code 65 on each run/build on iOS. So this plugin for me is shot, too.

What’s left is the deprecated plugin above: Again …

How did you configured the client side / the app? Like … Googe project number, Apple Certifactes etc.?
Did you still follow the tutorials on and WITHOUT using the Ionic web client? Or how did you do it?

For GCM I have allready a server api key and a project id. For APNS I have allready that certificates. What to do next after installing the plugin (and writing the js for registering)?

I know it’s deprecated, but it still works for now …

See the examples

The new one also did not build so I used the deprecated for now. Still have to investigate why it did not build.

The plugin only deals with register (getting the devicetoken) , unregister and api calls on notification. You still need a platform to actually register the devicetoken to the right notification provider. Some uses pushwoosh. I have used AWS SNS Mobile push wich works fine.

so, what final solution did you get ? I am stuck almost in same situation as you, I do not want to use PooshWoosh because its expensive for my client, I do not know how to use Parse with Ionic and finally IonicPush , whats the deal about it ? did you finally get iOS solution ?

For my client we used AWS SNS Mobile push with

Works like a charm on IOS and Android

Plugin seems deprecated, should I still use it ?
If I am using it AWS SNS is not required , right ? is there any specific plugin for AWS SNS too ?

I know its deprecated … but the new one did not compile so yeah … :smile:

I have not seen a plugin specific for AWS … but AWS also requires your own server with a registration/deregistration script … your script just pushes the devicetokens to AWS and AWS will register/deregister to Apple/Google.

thank you very much, so I try

but I found github difficult for ionic , though I have installed it in my app dest. folder, I do not know how to use it properly, would you pls recommend a step by step tutorial etc. for me. ?

Hi there,

I just wanted to confirm that builds and runs charming. I use GCM and APNS both with this plugin.

On Apple developer center create an **AppId **matching to the Id of your project (see config.xml, second line “widget”) and the Apple Push Notification service SSL Certificates. After that at the end you need the cert file (.cer), the private key (.p12) and its password. Configure your server with this infos.

On Google console create an AppId. Activate the Push-Notifications-Api. Create a server api key. The project number is for your register method in the app script. The server api key is for your server side and will be inserted into the payload of your push notification message.

Configuration-JSONs in the app script are …
… for APNS: var iosConfig = { "badge": true, "sound": true, "alert": true }; $cordovaPush.register(iosConfig);, get device token from this promise result.
… for GCM: var androidConfig = {'senderID': 'your Google Project Number and NOT server api key'}; $cordovaPush.register(androidConfig);, get device token from the fired event.

APNS: Take care what PN-certificate you use when taking care of the requested url (Using development certificate? Then call development url Using production certificate? Then call production url You can use port 2197 either).
GCM: Just request the one and only url with the server api key in the field authorization of the payload.

Every url request with JSON-Objects in POST method!

Read more about APNS:

Read more about GCM: … read the other parts, too. You can ignore the iOS parts.

That’s it! If you ask yourself why APNS is complicated in comparision to GCM then you’re not the only one :smile: