I’m using Ionic 4 + Capacitor to build a small POC app. I’m trying to implement the PushNotification plugin of Capacitor (not the Cordova/PhoneGap way).
I created the application in Firebase and got the google-services.json file which I placed in the Android/app folder.
I call PushNotifications.register() and successfully get a token back which I store in a “users” table in firebase for reference.
I then call:
PushNotifications.addListener(‘pushNotificationReceived’, (notification: PushNotification) => {
console.log('notification ’ + JSON.stringify(notification));
})
and I get a “result: Object” in the console upon execution of the statement having the correct token in the object properties.
I then create a new pushnotification through firebase console, and it shows me that the number of eligible users to receive the notification is “1” which shows that the client registered correctly.
However when I “publish” the test notification, nothing is received in the client and nothing is actually SENT from the firebase console when you click on the push entry to see the statistics.
I tried with both an android emulator and an android physical device. Same behaviour.
Any ideas on what is going wrong ?
Many thanks !
Chris