Hi,
I am using Firebase Push notifications in my app and trying to add a number to the app icon as the push notification comes in to the device when the app is not open.
I am using B4J to send the message and looked on the forum and found that I need to use the following:
This will add a 3 to the app icon.
I am then clearing the number as soon as the app opens by using:
From what I have read on the forum, I need to set the badge number from my B4J app.
My aim is to add 1 to the app icon each time the push notification is received, and clear it when the app is open.
As I am clearing the badge number as soon as the user opens the app, my B4J app doesn't know what number to show on the app icon next time it sends the push notification.
What is the best way in telling my B4J app what number it needs to send when it sends the push notification ?
I am guessing if the app is not open it can't send anything to my B4J app to tell it that it received the push notification, so it can send a notification to update the number on the app icon ?
The push notifications are not unique to the user, so I am not aware of the user at the time of sending the notification and I am sending it to the topic in firebase and all devices registered to that topic get it.
I am using Firebase Push notifications in my app and trying to add a number to the app icon as the push notification comes in to the device when the app is not open.
I am using B4J to send the message and looked on the forum and found that I need to use the following:
B4X:
Dim iosalert As Map = CreateMap("title": Title, "body": Body, "sound": "default", "badge": 3)
This will add a 3 to the app icon.
I am then clearing the number as soon as the app opens by using:
B4X:
App.ApplicationIconBadgeNumber = 0
From what I have read on the forum, I need to set the badge number from my B4J app.
My aim is to add 1 to the app icon each time the push notification is received, and clear it when the app is open.
As I am clearing the badge number as soon as the user opens the app, my B4J app doesn't know what number to show on the app icon next time it sends the push notification.
What is the best way in telling my B4J app what number it needs to send when it sends the push notification ?
I am guessing if the app is not open it can't send anything to my B4J app to tell it that it received the push notification, so it can send a notification to update the number on the app icon ?
The push notifications are not unique to the user, so I am not aware of the user at the time of sending the notification and I am sending it to the topic in firebase and all devices registered to that topic get it.