I have an Android App (Angular + Ionic) that uses Firebase to sent notifications. The app has been working for a while with no problems. I recently made some changes to the DB service of the app - nothing to do with the Firebase notifications at all. Now, some notifications are not being sent. Sometimes they are not even registered in the Realtime DB (used to trigger the Cloud Function that sends out the notification) and sometime it is registered in the DB, triggers the function, and the function throws an error:
Error: The registration token is not a valid FCM registration token
The notification is pushed seconds after registration. When I compare the token received in Registration with the token presented by the Function in the log - it is identical. I have no idea what is causing this behavior, any direction please?
Registration code:
PushNotifications.addListener("registration", (token: Token) => {
if (token && !this.tokenProcessed) {
this.tokenProcessed = true;
console.log('My token: ' + JSON.stringify(token));
this.onFCMTokenChanged.next(token.value);
}
});
Console log output:
My token: {"value":"D8636BCC62A673B4D574736AFCA1F73AF7C34EBBB7D99A38E05CDB6963FEAE8B"}

This happened due to unfinished Firebase configurations in the project side for iOS: In file: ios/App/Podfile Add the Firebase/Messaging pod:
From the ios/App folder, run: pod install
ios/App/App/AppDelegate.swift file:
For some reason, my GoogleService-Info.plist file was available in the ios/App/App folder in Finder, but not showing in the project navigator in xcode. I had to right-click on the App folder and select "Add file to project..."
In xcode - clean build folder (Product -> Clean build folder). Re-build the project into your device.