Push Notifications / How does it work?

Hi everybody,
i would like install in my ionic app a Notifications system that users can be noticed when someone answer to their questions.

User 1 ask a question => Another user on another device answer => user 1 receive a notification on his device.

I tried many many scripts but now … i’m lost.
What system are you working on ? Can you help me to find the right direction.

Thanks in advance, Regards.

The base system of push services:

A device installs your app, after login or app start (it depends how you app works) the app will send the information to apn or gcm service, that this device with this UUID wants to receive notifications. After that you get the registration token from the service as response. now your backend or third party service needs to know that token to send notifications to it.

Once the device is registered you can use the service APIs of gcm or apn to send messages to that device via the registration token.

Every service should work ;).
But ionic services are in alpha state… so if you need something for commercial purpose you should wait until it is final.

i tried http://www.pushapps.mobi/
it is not that beauty but there is a free plan for testing purposes. They also have an example implementation with ionic and cordova!

Keep in mind, if you want to send push notifications over your backend --> you need the remote server api! (this access costs money!)

Thank you Bengtler for all details !
I tested this tutorial this night before reading your answer.
=> https://chriztalk.wordpress.com/category/ionic/

By executing this command node SendNotification.js , i received notifications on my Iphone.
A little step to the glory :smile:

1 - Is there any way to transform my file SendNotifications.js to an angular service or something else ? (I would like to send notifications to another device on click for exemple or another event).
Here is my SendNotification.js file

var http = require('http');
var apn = require('apn');
var url = require('url');
var deviceToken = '####################';  // ** NEED TO SET TO YOURS
var myDevice = new apn.Device(deviceToken);
var note = new apn.Notification();
note.badge = 1;
note.contentAvailable = 1;
note.alert = 'PushIt works:\n Congratulations! \u270C\u2764\u263A ';
note.payload = {'messageFrom': 'PushIt'}; 
note.device = myDevice;
var callback = function(errorNum, notification){
    console.log('Error is: %s', errorNum);
    console.log('Note ' + JSON.stringify(notification));
var options = {
    gateway: 'gateway.sandbox.push.apple.com', // this URL is different for Apple's Production Servers and changes when you go to production
    errorCallback: callback,
    cert: 'your-cert.pem', // ** NEED TO SET TO YOURS
    key:  'your-key.pem',  // ** NEED TO SET TO YOURS
    passphrase: 'your-pw', // ** NEED TO SET TO YOURS
    port: 2195,                       
    enhanced: true,                   
    cacheLength: 100                  
var apnsConnection = new apn.Connection(options);
console.log('Note ' + JSON.stringify(note));

2 - If i resume : “if you want to send push notifications over your backend --> you need the remote server api”.
I saw http://www.pushapps.mobi/ and i think it’s exactly what i was looking for.
Tell me if i’m wrong :

  • It cost money (about 20$ / Month)
  • I can implement it in my ionic app
  • i can send notifications to User 1 when User 2 click on this picture for exemple by sending a request to a php file host on MY server.

Thank you. You already helped me a lot :smile:
Have a good day and sorry again for my poor level in English

You understand it correctly. :smile:
There are big players for push notification sending like pushwoosh and so on, but i landed at pushapp.mobi for one project.
You can use your account for multiple apps and how i said… they have examples in their documentary for phonegap and ionic apps.

The UserInterface of their website is not as beauty but it works.
And maybe in some Months the ionic-services are going to a final state --> you can switch.