How to implement Google Cloud Messaging with ionic

Hello everybody, I wonder if anyone knows of any tutorials on how to implement Google Cloud Messaging with ionic, I need something stable that it can go to production, Push ionic works but is still alfa is very risky to put into production, if anyone knows how to use the GCM or any tutorial that can help me I am grateful.

You can actually use Ionic Push in your app, but send the push messages using any other push service (or even manually via GCM). This way you don’t depend on the Ionic Push service (backend), but can use the great library in your app.

And how can I use the GCM to send the message and take with the ionic push this would be what I consider the most interesting for my app

You build your app using Ionic Push - everything like it is in the docs. You can also use the web interface to send the first pushes.

Later, when you don’t trust Ionic Push any more you can use any other push service that can push to push tokens directly or use one of the many push servers that connect directly to GCM to do this.

I 've done THIS IS NOT no However Working When the application IS Closed.

Sorry, I don’t understand what you want to say. What is not working when? What would be the expected result?

The work fot notification if the application is open, if I close it and try to send the notification it not to receive.

yes I will use ionic Push,
Yes my app is enabled in mode of development,
For now I’m using ionic CLI to send notifications ,
I hope that when I send a notification and the application is closed the notification appears on the screen of the application , and this is not occurring

Then I quote this from the documentation:

Development pushes aren’t native push notifications, and are meant for testing against our API. They’ll work in a browser or emulator, but won’t arrive when your app is minimized, and the tokens won’t last more than 2 hours.

so how can I develop something resembling the native push

Turn off dev_push - then it is native.

Thanks for help, work :slight_smile:

I did many trials to did it but there are no output? how I can send notifications to more than one device at same time
?

Google moved the GCM for the FCM is to send eviar push to several devices at the same time enough:

ionic plugin add cordova-plugin-inappbrowser
ionic plugin add cordova-plugin-fcm
ionic plugin add cordova-plugin-velda-devicefeedback

And go to Firebase Console

Create New Project
Add a Name to your project
Select which platform you like (ios/android)
Add your Package Name which is the id of your app, (you can see it in your config.xml something like id=“com.ionicframework.someTest123”) It will give you a file google-services.json
Paste it in the platforms/android/ directory
Then run ionic build android on your CLI
And you can now go to Notifications Page > New Message Make sure to select the app (id of the app) you added before sending push notification.

works on android, but on ios, no notification received !!??

Hello, it’s work on android and IOS https://github.com/1fabiopereira/cordova-plugin-fcm