expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
30.87k stars 4.88k forks source link

Push notifications do not work when received #24167

Closed janusqa closed 10 months ago

janusqa commented 10 months ago

Minimal reproducible example

https://github.com/janusqa/rn-bare/tree/bug_pushnotifications

Summary

add your project id to the env file.

npm install npm start

Log in by clicking on the sign in link and get the push notification token that is outputted to the console Use https://expo.dev/notifications to send a push notification Click on it when it arrives. Expected something to be printed to console as defined in the response received listener, but nothing is printed.

When push notifications are received listeners are not aware that they have arrived. So clicking on them will do no additional work set up to be done when they are clicked on. Expectation is that when an notification is clicked on it should do the additional work specified in the appropriate listeners.

Environment

expo-env-info 1.0.5 environment info: System: OS: Linux 5.4 Ubuntu 20.04.6 LTS (Focal Fossa) Shell: 5.0.17 - /bin/bash Binaries: Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.14.0/bin/yarn npm: 9.4.2 - ~/.nvm/versions/node/v18.14.0/bin/npm SDKs: Android SDK: API Levels: 28, 29, 33 Build Tools: 30.0.3, 33.0.2 System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-31 | Google APIs Intel x86_64 Atom, android-33 | Google APIs Intel x86_64 Atom npmPackages: expo: ^49.0.3 => 49.0.5 react: 18.2.0 => 18.2.0 react-native: 0.72.4 => 0.72.4 Expo Workflow: managed

janusqa commented 10 months ago

I managed to get it working by 1) setting up a firebase project 2) create an expo.dev project 2) enabling legacy cloud messaging and grabbing the cloud messaging server key 3) creating a dev build for react-native project 4) adding the firebase cloud messaging server key to the expo.dev projects credentials area