crux-bphc / CMS-Android

A custom Moodle app for the students of BITS Pilani, Hyderabad Campus.
MIT License
28 stars 39 forks source link

Handle push notifications when app in the foreground #289

Open abhijeetviswa opened 3 years ago

abhijeetviswa commented 3 years ago

The notification pushed through Firebase is a Notification + Data message (documentation). The framework creates a notification when the app is in the foreground (without the app handling it). However, while the app is in the background, no notification is displayed and instead the app is called back and it's our responsibility to handle the data.

The app had to be modified to handle data from notifications. It is easier to simply duplicate this effect when the app is in the background. We need to style the notification so that it looks similar to the notification created by the framework.