Please provide the following:
- SDK Version: 40.0.1
- Platforms(Android/iOS/web/all): Android
- Add the appropriate “Tag” based on what Expo library you have a question on.
Hello, I have read all the documentations on how to set up expo push notification from setup, to sending, to receiving. However I am confused on the receiving documentation. I am currently tryig to use expo notifications and am developing in the bare workflow environment.
Currently I intend on making two types of push notification. One from my backend for updates of the application, and another one as a scheduled push notification where the application gives the user a notification at a designated time (ex. 2021-06-30 14:15 pm).
I can more or less understand sending the notifications but I am confused on how I add the listeners. Unlike other listeners that may be unique to individual screens, to my understanding the notification listener should be global since it should be ready for it at any point. In other words the listener should be applied throughout the entire time the app is open or closed, regardless of which screen you are in.
Where should we add this notification listener to achieve this effect? It does not mention in the documentation where we are to add the listener. My initial thought was that it should be added at the top-level of the application, which is the “app.js” file. But here I define the react native navigation containers, stacks, and tab navigators and cannot think of where the listener would fit in such a context.
So what is the proper place to add the notification listener? And how would we do that using useEffect in a react function component instead of what is documented (using componentDidMount() in the react class component)?