Push Notifications explained in React Native
A notification is a message that pops up on a mobile device whether an app is in foreground or background. It alerts user with a message which is displayed on the home screen or lock screen of the mobile device. Notifications are used to inform users about updated information or events. They provide important and useful information to the user.
- User generated notifications: These notifications contain content created by a human for sending to other human(s). Best example of this would be private messaging. But it also includes liking and commenting on any post on internet. The user who is supposed to know this update will get a notification regarding this.
- Context generated notifications: This type of notifications are used to share useful information to the users who might be interested on particulars . Best example of this type of notification is asking an app to notify location based updates i.e app alerts the user if a person or place is nearby. User can subscribe to specific category of news in form of notification alerts.
- System generated notifications: This type of notifications are generated by android os/iOS which inform users mostly about system software or device state. This adds great value for end user. Best example of this is a message displayed by operating system to alert user that device battery is too low. System also informs users about system updates.
Mobile application needs user permissions to display notifications on mobile device. React native handles both iOS and Android notifications. Push notification refers to notification sent from a server to mobile device whereas local notifications are popped by mobile app itself.
React native uses npm (Node Package Manager) to install third party libraries which enable push notification in iOS and Android. Users can subscribe to some content to get the notification from. Then the user receives regular notifications whenever he/she supposed to receive and view.
React Native is still evolving. It can happen that both technologies(iOS/Android) would not share same kind of components and properties i.e some properties/components only support on one platform. But React Native keeps supporting developers by updating their libraries regularly.
Notification settings need to be configured differently according to platform. It requires apps to ask users for notification permissions. It may also need to ask the user about location permission and accessing other data.
React Native triggers some events and methods during its task of displaying notification. Notifications are handled when users tap on them to trigger some activity. Tapping notification might open related mobile app and show some useful information.
Some helpful NPM for push notification implement in React Native apps