我想在iOS cordova应用程序中实现firebase云消息传递。
我试过cordovan-plugin-fcm插件,它可以在iOS 9下运行,但不能在iOS 10上运行。
我的问题是,哪个是实现推送通知的最好的cordova firebase插件?是iOS 9还是10?
发布于 2017-05-03 13:10:07
尝试实现这一点。https://github.com/fechanique/cordova-plugin-fcm
然后从你的firebase帐户,尝试发送通知。看起来不错。
发布于 2017-09-21 14:47:43
我试过了,它在iOS9.3的模拟器上工作,但如果在iOS10.3的模拟器上尝试同样的方法,就没有消息了。这是我的代码:
FCMPlugin.getToken(function(token){
if ( device.platform == 'android' || device.platform == 'Android' || device.platform == "amazon-fireos" ){
sendPushRegistration(token, 'android');
} else {
sendPushRegistration(token, 'ios');
}
});
FCMPlugin.onTokenRefresh(function(token){
if ( device.platform == 'android' || device.platform == 'Android' || device.platform == "amazon-fireos" ){
sendPushRegistration(token, 'android');
} else {
sendPushRegistration(token, 'ios');
}
});
FCMPlugin.onNotification(function(data){
alert('onNotification');
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) );
}
});我在getToken函数中得到一个令牌。但是在iOS10.3中没有调用onNotification函数,在iOS9.3中它可以工作。插件是cordova- Plugin -fcm 2.1.2 "FCMPlugin“,消息通过firebase控制台发送到一个设备。
https://stackoverflow.com/questions/43751452
复制相似问题