Interact with notifications
Push notifications are powerful engagement tools for your users as they can be delivered even when your app is not in the active foreground. As a result, there are many cases where it is helpful (or perhaps necessary) to interact with notification events differently depending upon your app's state.
- Foreground state: Your app is running, active and visible.
- Background state: Your app is still running but is not currently active and visible. The user is usually on the home screen or in another app.
- Terminated state: Your app is no longer running, even in the background. The user can initiate this by swiping your app away in the app switcher.
Notification lifecycle
Before delving into details about the various functions Amplify provides, it can be helpful to better understand the lifecycle of a notification as it moves through your app in its various states once you've integrated Amplify Push Notifications.
For the purposes of this guide, we will simplify the terminology as follows
- Native layer - This is the native (i.e. iOS or Android) application layer on top of which React Native apps are built.
- Application layer - This is your React Native app.