Open kryptus36 opened 3 years ago
Having the same issue, for now I am resolving it by double checking the gcm message id:
//import at the top
import * as application from '@nativescript/core/application';
// array to remember received notifications per session (declare outside the callback function)
let receivedNotifications = []
// beginning of the onMessageReceivedCallback
if (application.ios) {
const messageId = message['gcm.message_id'];
// if already received, return
if (receivedNotifications.includes(messageId))
return;
// else remember the message id and move forward
this.receivedNotifications.push(messageId);
// do your stuff
}
Using NS 7.0.11, plugin version 11.1.3 I am finding both onPushTokenReceivedCallback and onMessageReceivedCallback are called twice on iOS.
Seems fine on Android.
Possibly related: https://stackoverflow.com/questions/64501709/nativescript-firebase-onmessagereceivedcallback-does-not-fire-on-ios