Push Notifications

In order to setup Push Notifications with your own OneSignal account you have to do the following:

  • First you should register to https://onesignal.com/
  • Create a new Application there and follow the Documentation guides for Ionic projects:
  • https://documentation.onesignal.com/docs/ionic-sdk
  • Don’t forget to install OneSignal Cordova plugin in your app folder
    $ cordova plugin add onesignal-cordova-plugin
  • Edit www/js/providers/constants/app-config.js with your custom OneSignal App settings:
    OneSignal: {
    	enable: true,
    	appId: 'bff790de-6c7b-4550-9202-0acebb924b28', //Your OneSignal app id from onesignal.com
    	options: {
    		googleProjectNumber: '295165547597' //required for Android
    	}
    }
  • Update the 3 init parameters
    • Replace bff790de-6c7b-4550-9202-0acebb924b28 with your OneSignal AppId.
    • Replace 295165547597 with your Google Project Number. (If your app isn’t for Android you can replace the number with a blank string)
    • Change the code in the notificationOpenedCallback function to your liking
      • The function is called when you tap on a notification
      • Callback is option if you only want the app to open when a notification is tapped on.