Open pierrybos opened 7 years ago
Check this pull request out https://github.com/fechanique/cordova-plugin-fcm/pull/255
And if you ever want to submit your app to the apple app store, you wont get past this pull request. https://github.com/fechanique/cordova-plugin-fcm/pull/339
I use myself the updated sdk version, it works for me on ios 9 and 10.
So... we need wait?
I just use this pull request https://github.com/fechanique/cordova-plugin-fcm/pull/339 and everything runs fine for me, upload to apple store no problems.
Look at all the pull requests, the project is not very active but it is still the best solution for fcm, I tried any other and it was always a struggle with outdated stuff.
I hope, we get sometime a good upgrade here, that would be great. For now I install it right from git like below. That is my work account
npm install git+https://github.com/ostownsville/cordova-plugin-fcm.git
I you use that, you will have to, after installation, copy the GoogleService-Info file into the folder "platform/ios/projectname/Resources/Resources"
Depending on what you use, I use ionic.
I tried with "cordova plugin add" but have problems to build with android. I will try again with "npm install"
I installed it with
phonegap plugin add https://github.com/ostownsville/cordova-plugin-fcm.git --save
And I was able to compile both, iOS & Android. On android master was working but not on iOS. As soon as Apple let me deploy on testflight I'll report.
Thanks!
For IOS to work you need to make the set up with the certificates in firebase under cloud settings.
Cheers
@pierrybos you are right it has to be cordova plugin add git+...... If the android build doesn't work, follow the error messages. It could be that you need a android sdk upgrade to 25.0, I believe to remember.
Just as an idea
I know @CowboyCode I got it working with master, but in iOS, when app was if foreground and FCMPlugin.onNotification should be triggered, the phone enters in a kind of endless loop and as soon as I close the app or send it to background, notificatiin sound was received and in logs, the notificatiin was dispatched but triggering FCMPlugin.onNotification, not using iOS notification center.
If this behabiour persists I'll post some logs.
Kind regards
Ok, in my javascript code i use
if(typeof(FCMPlugin) != 'undefined') {
FCMPlugin.onNotification(function(data){
console.log(data)
})
}
Anyway, using that above, the app will only make a noise if the app is in background, if the app is open, you have to do some coding to show the message.
if(typeof(FCMPlugin) != 'undefined') {
FCMPlugin.onNotification(function(data){
alert(JSON.stringify(data))
})
}
I have a project and testing FCMPlugin in a IOS10 and a 9. On my iPad 2 (with iOS 9) I recieve message, but on tap, onNotification is not dispatch. iOS 10 all is fine.
cordova-ios 4.3.1 cordova 7.0.1 fcm-plugin: 2.1.2