Hi,
I have a problem with calling a function after receiving a push notification in my App. In fact, when the screen of the device is off, the firebase service in my app does not run!
For example, when the phone screen is off and the app gets a message, the function of StaticMethods.Read_Notification_Info does not run!
I have a problem with calling a function after receiving a push notification in my App. In fact, when the screen of the device is off, the firebase service in my app does not run!
For example, when the phone screen is off and the app gets a message, the function of StaticMethods.Read_Notification_Info does not run!
B4X:
#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
Private fm As FirebaseMessaging
End Sub
Sub Service_Create
fm.Initialize("fm")
Log(fm.Token)
End Sub
Public Sub SubscribeToTopics
fm.SubscribeToTopic(StaticMethods.FCM_APP_TOPIC)
End Sub
Sub Service_Start (StartingIntent As Intent)
If fm.HandleIntent(StartingIntent) Then Return
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log(Message.GetData.Get("body"))
StaticMethods.Read_Notification_Info(Message.GetData.Get("body"))
End Sub
Sub fm_TokenRefresh (Token As String)
Log("Token is " & Token)
End Sub
Sub Service_Destroy
End Sub