I am using NativeScript-Vue (7.0) and using this code to initialize Firebase:
firebase.init({
onMessageReceivedCallback: (message) => {
console.log("[Firebase] onMessageReceivedCallback:", { message });
},
onPushTokenReceivedCallback: (token) => {
console.log("[Firebase] onPushTokenReceivedCallback:", { token });
},
})
.then(() => console.log("Firebase initialised."));
Everything works fine on Android, but on iOS (on simulator as well as on a real device) two things are happening:
onPushTokenReceivedCallbackis fired TWICE (with same token)onMessageReceivedCallbackis never fired even when app is in foreground.
I am using FCM Dashboard to send notifications, tried both Test as well as Campaign notification with custom data. It only worked in Android.
I understand there are complications in implementing background push notifications in iOS but in foreground when app is running, why isn't it receiving the message?
I am using this firebase plugin and I followed everything in the docs apart from one thing that is Enabling push support in Xcode as apparently this setting is gone from Xcode for free apple developer accounts. But I did add the entitlements manually as mentioned here.
Does receiving message call back require some special permission or am I missing out on something?