Recently, The Ionic Framework team updated the native plugin version to 2.3. The native plugin version 2.3 uses the new syntax and new functions too. So if you use the old code in the latest native version, then it won't work.

This tutorial focuses the push notification plugin version 2.3 using the Firebase service provider. If you are using the push notification version less than 2.3, then visit the below link, which contains the working code for push notification version less than 2.3.

https://ampersandacademy.com/tutorials/ionic-framework-version-2/push-notification-using-google-firebase

Create a new project using the below command.

ionic start pushnotification blank --v2

Then add the Android platform using.

cd pushnotification
ionic platform add android

To install the push notification plugin, you must need the SENDER ID. To get SENDER ID, log-in to the Firebase console using.

https://console.firebase.google.com

For more information about the SENDER ID, Please visit the below link.

https://ampersandacademy.com/tutorials/ionic-framework-version-2/push-notification-using-google-firebase

The above link explains, how to create a new project under Firebase hosting and where to get the SENDER ID.
 
 After receiving the SENDER ID, install the push notification plugin with the SENDER ID using.

ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX --save
npm install --save @ionic-native/push

Replace XXXXXXXXX with your SENDER ID.

Now import the push notification to the app.module.ts file using

import { Push, PushObject, PushOptions } from '@ionic-native/push';

Then add the Push class to the provider using.

providers: [Push,
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]

Now open the app.component.ts file and import the Push class and AlertController class using

import { Push, PushObject, PushOptions } from '@ionic-native/push';
import {AlertController} from "ionic-angular";

Now create a reference variable for Push and AlertController using.

constructor(platform: Platform, statusBar: StatusBar,
splashScreen: SplashScreen,
private push: Push,public alertCtrl: AlertController)


Now create a initPushNotification function in the app.component.ts file.

initPushNotification()
{
// to check if we have permission
this.push.hasPermission()
.then((res: any) => {
if (res.isEnabled) {
console.log('We have permission to send push notifications');
} else {
console.log('We don\'t have permission to send push notifications');
}
});

// to initialize push notifications
const options: PushOptions = {
android: {
senderID: 'XXXXXXX'},
ios: {
alert: 'true',
badge: true,
sound: 'false'
},
windows: {}
};
const pushObject: PushObject = this.push.init(options);
pushObject.on('notification').subscribe((notification: any) =>{
console.log('Received a notification', notification);
//Notification Display Section
let confirmAlert = this.alertCtrl.create({
title: 'New Notification',
message: JSON.stringify(notification),
buttons: [{
text: 'Ignore',
role: 'cancel'
}, {
text: 'View',
handler: () => {
//TODO: Your logic here
//self.nav.push(DetailsPage, {message: data.message});
}
}]
});
confirmAlert.present();
//
});
pushObject.on('registration').
subscribe((registration: any) => 
console.log('Device registered', registration));
pushObject.on('error').
subscribe(error => 
console.error('Error with Push plugin', error));
}

Replace the XXXXXXX with your SENDER ID. The above function initiates the connection between the Firebase server and your device. The AlertController is used to display the notification in the Ionic 2 Style alert box.

Call the initPushNotification function inside the constructor.

constructor(platform: Platform,
statusBar: StatusBar,
splashScreen: SplashScreen,
private push: Push,public alertCtrl: AlertController) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
this.initPushNotification();
});
}

Now create an APK for android using

ionic build android

Install the Push Notification APK in your Android phone. Then go to the Firebase console and add your Ionic 2 project id to the Firebase Server. The Ionic 2 project id presents in the config.xml file. Then send notification using the Firebase server. 

That's all. The above code is tested and works fine on the Android phone. Please follow all the steps carefully.Even a simple comma mistake will throw an error. And you are not able to preview this app on the browser. The browser will throw some error like below.

Runtime Error
Uncaught (in promise):
cordova_not_available

Don't worry about the error. Why because you are calling the Push class when the platform is ready. That's why it is throwing error in the browser. However, the application will work an actual device, after generating APK.

Tested Device:
Yureka Plus

The below are the Ionic project information while writing this post.

Cordova CLI: 6.5.0 
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v6.10.0
Xcode version: Xcode 8.2.1