Hello,
if i click on the message and the app is open, then i have not Notification Tag why?
Service
Main
no intent found with this tag...
if i click on the message and the app is open, then i have not Notification Tag why?
Service
B4X:
#Region Service Attributes
#StartAtBoot: true
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private fm As FirebaseMessaging
Public mess As String
End Sub
Sub Service_Create
fm.Initialize("fm")
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized And fm.HandleIntent(StartingIntent) Then Return
End Sub
Sub Service_Destroy
End Sub
Public Sub SubscribeToTopics
fm.SubscribeToTopic("general") 'you can subscribe to more topics
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
mess = Message.GetData.Get("body")
Dim n As Notification
n.Initialize
n.Icon = "icon"
' n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
n.SetInfo2(Message.GetData.Get("title"), Message.GetData.Get("body"),"Notification_Tag", Main)
n.Notify(1)
End Sub
Main
B4X:
Sub Activity_Resume
Dim in As Intent
in = Activity.GetStartingIntent
If in.HasExtra("Notification_Tag") Then
Log(in.GetExtra("Notification_Tag")) 'Will log the tag
End If
End Sub