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?
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(...);
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??
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.
Thanks.
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 ionic.io servers, in the response message, say if it was a real push or a development push… That’s important for debugging and detecting errors…
Awesome! Our customer didn’t wanted to use Ionic.io 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 … https://github.com/phonegap-build/PushPlugin
The newer project on https://github.com/phonegap/phonegap-plugin-push which is used for the Ionic.io 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.
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)?
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 ?
@coreelements
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 …
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.
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. ?
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 api.development.push.apple.com:443. Using production certificate? Then call production url api.push.apple.com:443. You can use port 2197 either). GCM: Just request the one and only url https://gcm-http.googleapis.com/gcm/send with the server api key in the field authorization of the payload.
Every url request with JSON-Objects in POST method!