我知道这是重复的问题,但是我在SO和Ionic论坛上都找不到任何解决方案,这就是为什么再次询问
我该如何在其中进行推送通知
我遵循此过程
1)创建项目
2)添加离子 cordova插件,添加cordova-plugin-fcm 并按照说明进行操作
https://www.ttmind.com/TechPost/Firebase-Cloud-Messaging-FCM-using-Cordova-FCM-Plugin
3)添加android平台并在浏览器和Android设备中运行,但显示错误
caught ReferenceError: FCMPlugin is not defined
app.js:11
Array.<anonymous> (ionic.bundle.js:56238)
onPlatformReady (ionic.bundle.js:2496)
onWindowLoad (ionic.bundle.js:2477)
在app.js中使用了此代码
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);
}
);
但是请告诉我这个错误