Android notification Screen

Viewed 25

I'm creating an ecommerce app and I want to send promotional notifications to users from firebase cloud messaging. I want to show all the notifications in recycler view in notification screen using adapter can anyone tell how do I save all incoming notifications and display them in notification screen

2 Answers
  1. If you want to show all notifications you need to save those in local database when you receive and fetch all on required screen. You can use Room database for the same.

  2. You can ask the backend developer to save all notifications at backend side and fetch those by an API.

Approach 1

See If you are sending a notification from the firebase console, Then you need to save that notification in the local DB While It receives in Mobile Firebase Messaging Service Class. (but It's not a good approach, Because user loss notification in case of clear data for app or reinstall app)

Approach 2

If you are sending notifications using some API or firebase function Then you can create one collection of Notifications and save notifications every time while sending And Fetch notifications from the same collection.

Related