Notifications.addNotificationResponseReceivedListeneronly triggers when user taps on push notification and the app is foregrounded or backgrounded.
If the app is opened by the push tap, then Notifications.addNotificationResponseReceivedListener is never triggered and then I have no way to handle the push.
I just upgraded from SDK37 (it used to work without issues) and I decided to also upgrade to “expo-notifications” as well.
Thank you in advance!
import * as Notifications from 'expo-notifications';
export default ({ navigation }) => {
useEffect(()=>{
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: false,
shouldSetBadge: false
})
});
Notifications.addNotificationResponseReceivedListener(handlePush);
return () => {
Notifications.removeNotificationSubscription();
}
},[]);
const handlePush = async(response) => {
// It only reaches this function when the App was foregrounded or backgrounded, but it never reaches here if the app was previously killed.
}
return null;
}
Since this needs to stay open(!) I will ask- does anyone know how to get an issue moved up the stack? This was opened in February and STILL has no one assigned to it!
I can’t release my product until notifications work ;(
It would be good to know if I should roll back (ugh) if they intend to ignore it for another 5 months.
Realize this is a little off-topic but is there anyone on this thread also experiencing other issues with notifications on 38 and useNextNotificationsApi?
Are you guys also able to hide the alerts in Android with shouldShowAlert?
I think it’s somehow all connected to v38 and useNextNotificationsApi.