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.5.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.
Step 2: Build and test your app.
ionic cordova build android