Android Question Handling of Firebase Notifications Bundles - Differences between Andriod & Web Firebase Messages.

Mashiane

Expert
Licensed User
Longtime User
Ola

When your app is running, all notifications even if you close the app have a Notification_Tag

For example.

B4X:
Bundle[{Notification_Tag={"msgtitle":"Anele Mbanga, XXX","msgtopic":"A11","msgdeviceid":"XXX","msgbody":"Type a message here","msgdate":"2021-02-05 03:35:32","msgtel1":"XXXXX","msgtel2":"XXXXX","msgtype":"message"}}]

Now when your app is closed, and the firebase message being sent is via a web app, the notification does not have a Notification_Tag

For example

B4X:
Bundle[{google.delivered_priority=normal, google.sent_time=1612489030324, google.ttl=2419200, google.original_priority=normal, msgtitle=Anele Mbanga, XXX, msgtopic=A11, from=/topics/A11, msgdeviceid=XXX, google.message_id=0:1612489030734137%d20fd211d20fd211, msgbody=Type a message here, msgdate=2021-02-05 03:37:09, msgtel1=XXXXX, msgtel2=XXXXX, msgtype=message, collapse_key=XXXX}]

Usually to process this inside the app, one uses.

B4X:
If in.HasExtra("Notification_Tag") Then

Now with the second notification type..

Q1. Is there a way to ensure that the web msg have a Notification_Tag?
Q2. How do I read the contents of the second message. I want to get everything from msgtitle until msgtype.

Thanks.
 

Mashiane

Expert
Licensed User
Longtime User
The notifications are being sent from a web app that I'm developing and not the firebase console and they are using the same methodology of a Post request. So that is not the issue.

When the app is not running, the notification does not have the notification_tag. This is not an issue when the android app is running.

Perhaps I should just parse this because after all its a string and get what I need.
 
Upvote 0
Top