I am using the pushNotifications module along with firebase to send push notifications to Android. Firebase integration is working and I am able to register the device and retrieve the token. I am also able to trigger a test message with the token, however, I get the following issue.
When I trigger a push notification, Android Studio logcat indicates the following:
Notifying listeners for event notificationReceived
No listeners found for event notificationReceived
Based on the following (from the documentation), the event listener is called “pushNotificationReceived” and I have the following code:
PushNotifications.addListener(
"pushNotificationReceived",
(notification) => {
alert("Push received: " + JSON.stringify(notification));
}
);
Given that the above indicates that there must be a listerened called notificationReceived, I have also added the following listener:
PushNotifications.addListener("notificationReceived", (notification) => {
alert("Push action performed: " + JSON.stringify(notification));
});
From the console I can see that the listeners are registered:
To native (Capacitor plugin): callbackId: 96304817, pluginId: PushNotifications, methodName: addListener
callback: 96304817, pluginId: PushNotifications, methodName: addListener, methodData: {"eventName":"notificationReceived"}
To native (Capacitor plugin): callbackId: 96304820, pluginId: PushNotifications, methodName: addListener
callback: 96304820, pluginId: PushNotifications, methodName: addListener, methodData: {"eventName":"pushNotificationReceived"}
I am not sure what else to do here as it appears at face value that the event listener for both pushNotificationReceived and notificationReceived is created, but not implimented.