Step 1: Import PushBots Plugin:

1.1. Run the following from the terminal in your project directory:

For Ionic CLI V2

ionic plugin add pushbots-cordova-plugin --save

For Ionic CLI V3

ionic cordova plugin add pushbots-cordova-plugin --save

For Ionic Pro 

ionic cordova plugin add pushbots-cordova-plugin@1.6.x

Step 2: Add Required code:

For Ionic V1 

Add this line to your js/index.js to intialize Pushbots in onDeviceReady section:

window.plugins.PushbotsPlugin.initialize("PUSHBOTS_APPLICATION_ID", {"android":{"sender_id":"GOOGLE_SENDER_ID"}});

For ionic V2+ Add this line to src/app/app.component.ts to intialize Pushbots in platform.ready() function in constructor section:

window["plugins"].PushbotsPlugin.initialize("PUSHBOTS_APPLICATION_ID", {"android":{"sender_id":"GOOGLE_SENDER_ID"}});
  • You should replace PUSHBOTS_APPLICATION_ID with the application ID found in Keys tab in app settings, and GOOGLE_SENDER_ID with the senderID generated using this guide.

Prepare the app

ionic cordova prepare ios

Step 3: Enable Push notifications:

Now open the xcode workspace file in xcode:

platforms/ios/APP_TITLE.xcworkspace

Make sure Automatic manage signing is enabled:

Enable background modes and Push notifications in capabilities:

Build iOS app:

ionic cordova build ios

Did this answer your question?