How can i do that push notification in this
I follow this process
- Create the Project
- Add the ionic cordova plugin add cordova-plugin-fcm
and Follow those instruction
https://www.ttmind.com/TechPost/Firebase-Cloud-Messaging-FCM-using-Cordova-FCM-Plugin
- Add android Platform and run in browser and Android Device but is giving me the Error
caught ReferenceError: FCMPlugin is not defined
** ** app.js:11
** ** Array. (ionic.bundle.js:56238)**
** ** onPlatformReady (ionic.bundle.js:2496)**
** ** onWindowLoad (ionic.bundle.js:2477)**
And in app.js used this code
FCMPlugin.onTokenRefresh(function(token){
alert( token );
var div = document.getElementById(‘divToken’);
div.innerHTML += token;
});
FCMPlugin.onNotification(
function(data){
if(data.wasTapped){
//Notification was received on device tray and tapped by the user.
alert( JSON.stringify(data) );
}else{
//Notification was received in foreground. Maybe the user needs to be notified.
alert( JSON.stringify(data) );
}
},
function(msg){
console.log('onNotification callback successfully registered: ' + msg);
},
function(err){
console.log('Error registering onNotification callback: ' + err);
}
);
But show me this error