Hello,
I have a question when receiving notifications sent through a script https://fcm.googleapis.com/fcm/send.
When the application is in the foreground the notification is received, I click on the notification and the fm_MessageArrived event is executed, but when the application is paused or off I receive notifications correctly but when I click on the notification the fm_MessageArrived event does not fire and I can´t handle any event in order to open an activity or display a message.
I've done some tests but I can not get it to work, I do not know if I'm missing something.
I am using B4 8.30, NB6, target sdk 26, I have a FirebaseMessaging service with this code:
In the starter service I have this:
Thank you.
I have a question when receiving notifications sent through a script https://fcm.googleapis.com/fcm/send.
When the application is in the foreground the notification is received, I click on the notification and the fm_MessageArrived event is executed, but when the application is paused or off I receive notifications correctly but when I click on the notification the fm_MessageArrived event does not fire and I can´t handle any event in order to open an activity or display a message.
I've done some tests but I can not get it to work, I do not know if I'm missing something.
I am using B4 8.30, NB6, target sdk 26, I have a FirebaseMessaging service with this code:
B4X:
Sub Service_Create
fm.Initialize("fm")
SubscribeToTopics
End Sub
Public Sub SubscribeToTopics
Log("Suscrito a fireBase")
fm.SubscribeToTopic("general") 'you can subscribe to more topics
Globals.Token = fm.Token
Log("Token:" & Globals.Token)
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized And fm.HandleIntent(StartingIntent) Then Return
Sleep(0) 'allow the MessageReceived event to be raised.
Service.StopAutomaticForeground
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
End Sub
In the starter service I have this:
B4X:
Sub Service_Create
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
End Sub
Thank you.