Hi everyone,
I noticed that in B4A it is possible to manage an incoming Firebase message in the Sub fm_MessageArrived (Message As RemoteMessage) within the FirebaseMessaging service.
For example, here it is possible to decide whether a given message should be notified or not depending on a parameter.
Example:
I can't reproduce the same in B4I, or to be more precise, only if the application is running by intervening in the Sub Application_RemoteNotification (Message As Map, CompletionHandler As CompletionHandler).
If the application is in background mode, all incoming Firebase messages are notified regardless. How can I decide in this case which messages need to be notified and which are not?
I noticed that in B4A it is possible to manage an incoming Firebase message in the Sub fm_MessageArrived (Message As RemoteMessage) within the FirebaseMessaging service.
For example, here it is possible to decide whether a given message should be notified or not depending on a parameter.
Example:
B4X:
Sub fm_MessageArrived(Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
Log("MESSAGE FROM = "&Message.From)
'-------------- CONDITION TO SHOW NOTIFICATION --------------
If Message.GetData.Get("id_company") = Main.id_company Then
Dim notify As NotificationBuilder
notify.Initialize
notify.SmallIcon = "icon"
notify.AutoCancel = True
notify.ContentTitle = Message.GetData.Get("title")
notify.ContentText = Message.GetData.Get("body")
notify.Notify(1)
End If
End Sub
If the application is in background mode, all incoming Firebase messages are notified regardless. How can I decide in this case which messages need to be notified and which are not?
Last edited: