Android Question NB6 Firebase Messaging

prajinpraveen

Active Member
Licensed User
Longtime User
I am creating notifications using FirebaseMessaging. I have used some of the functions mentioned here.

Scenario : Send two or more notifications to the android app.
When the target is set to a service name in nb6.build(...), the corresponding "service_start" is executed only when the first notification is clicked.
when the second notification is clicked, "service_start" is not executed << Problem

Code:
Sub Service_Start (StartingIntent As Intent)
    If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
    Sleep(0)
    Service.StopAutomaticForeground 'remove if not using B4A v8+.
End Sub

when the target is set to an Activity name, activity_resume is called every time the notification is clicked. How do i get this working for a service.
I am trying to run a piece of code before showing a activity based on user logged in status.

thank you
 
Last edited:

prajinpraveen

Active Member
Licensed User
Longtime User
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
    Log("Message arrived")
    Log($"Message data: ID ${Message.MessageId}, Data ${Message.GetData}"$)
    
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "DEFAULT",False).AutoCancel(True)
    
    n.Build(Message.GetData.Get("title"), Message.GetData.Get("body"), "tag", Null,"FirebaseMessaging").Notify(DateTime.Now)
End Sub
 
Upvote 0
Top