I have started working on the POC for push notifications and checked out this : Push Notifications Overview - Expo Documentation. I directly copy pasted this code and tried to run on my devices. I am able to generate push notification by click on button but these 2 listeners are not getting fired : Notifications.addNotificationReceivedListener and Notifications.addNotificationResponseReceivedListener. Also, the title and message content are not getting updated.
Can someone please help me solve this? Is there anything missing in official docs. I have generated google-services.json and put it in app.json
I found that the api using sdk 37 is still useful, hope it will help you.
import * as Notifications from 'expo-notifications';
import { Notifications as Notifications2 } from 'expo';
Notifications.addNotificationReceivedListener((notification) => {
// It didn't work for me
});
Notifications2.addListener((data) => {
// This works for me
});
I have just ran into this same issue. I am able to successfully send a notification to my phone using android, but when I click on it, neither the addNotificationReceivedListener or the addNotificationResponseReceivedListener listeners are getting fired. I am using expo 38
I have no information, for two days I try to setup push notification on Android and FCM. Sending push notification via FCM is not documented, only if you using expo servers.
When I send to FCM in this callback is got nothing:
Notifications2.addListener((data) => {
// This works for me
console.log('App was opened by notification: ', data)
setNotification(data);