1

I am trying to build an app which receives notification from the server. I have configured FCM with my backend server which sends out the notifications, and every notification thats being sent from the server, i receive it on my emulator.

What i am struggling to understand is how do i list all the received notifications and display them in a view.

I am imagining how whatsapp does, you get a notification and then on click of that notification, you'll be taken to that notification full view. I presume there's an onClick action or similar to achieve this, but what i am struggling to understand is how do i list all the notifications in a particular view?

Or is it like notifications are totally separate than what can be listed in a view? If thats the case, perhaps i will have to make another api call to fetch all the notifications.

I am using FCM and now trying to make it work on Android.

Any help is appreciated.

Thanks, Vikram

  id: new Date().valueOf().toString(), // (optional for instant notification)
      title: notif.fcm.title, // as FCM payload
      body: notif.fcm.body, // as FCM payload (required)
      sound: "bell.mp3", // "default" or filename
      priority: "high", // as FCM payload
      click_action: "com.myapp.package", // as FCM payload - this is used as category identifier on iOS.
      badge: 10, // as FCM payload IOS only, set 0 to clear badges
      number: 10, // Android only
      ticker: "My Notification Ticker", // Android only
      auto_cancel: true, // Android only (default true)
      large_icon:
        "https://image.freepik.com/free-icon/small-boy-cartoon_318-38077.jpg", // Android only
      icon: "ic_launcher", // as FCM payload, you can relace this with custom icon you put in mipmap
      big_text: "Show when notification is expanded", // Android only
      sub_text: "This is a subText", // Android only
      color: "Gray", // Android only
      vibrate: 300, // Android only default: 300, no vibration if you pass 0
      wake_screen: true, // Android only, wake up screen when notification arrives
      group: "group", // Android only 
      ongoing: true, // Android only
      my_custom_data: "my_custom_field_value", // extra data you want to throw
      lights: true, // Android only, LED blinking (default false)
      show_in_foreground: true // notification when app is in foreground (local & remote)

Above is what i use to presentLocalnotification, do you mean to say that have to use the id to display it in a view? And how would you do it?

Vikram Mahishi
  • 2,871
  • 3
  • 15
  • 19

0 Answers0