-1

In my project I have one activity, a broadcast receiver to check the notification received and the firebase notification services. I am creating notification with different ids, but I am setting message of last received message. What I want is to handle the body of all the notification separately, So when I am tap on particular one notification it will return the exact body which is regarding to that one. How can I get the body separately? Or how can I store that notifications so that I can handle it when I need it..

Thanks in advance guys..

KENdi
  • 7,576
  • 2
  • 16
  • 31

1 Answers1

1

Try this

What you can do is you can store notification in sqlite database when it arrives. so whenever you need it you can get it from database. Just create table Notification with fields like

notification = notification unique id

message = notification body

type = notification type(if you have different type of notification)

This way you can handle notification when you need it.

Pang
  • 9,564
  • 146
  • 81
  • 122
Jaymin
  • 2,879
  • 3
  • 19
  • 35
  • no i have only one typo notification like global.. but in that topic message i have to manage all notification body.... That is the main issue – Kuldeep Jindani May 18 '17 at 07:17
  • How can i do this.. Have you any example ? Then Please show me. – Kuldeep Jindani May 18 '17 at 08:53
  • **Try this code** `try { JSONObject jsonObject = new JSONObject(remoteMessage.getData()); if (jsonObject.has("your tags")) { // Hnadle message // generate notification } } catch (Exception e) { e.printStackTrace(); } ` – Jaymin May 18 '17 at 09:14