#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
Private fm As FirebaseMessaging
End Sub
Sub Service_Create
If fm.IsInitialized = False Then fm.Initialize("fm")
End Sub
Public Sub SubscribeToTopics
If fm.IsInitialized = False Then fm.Initialize("fm")
Try
fm.SubscribeToTopic("general") 'you can subscribe to more topics
Catch
If LastException.IsInitialized Then Log(LastException)
End Try
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized And fm.IsInitialized Then
Try
If fm.HandleIntent(StartingIntent) Then Return
Catch
If LastException.IsInitialized Then Log(LastException)
End Try
End If
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Try
Dim n As Notification
If n.IsInitialized = False Then n.Initialize
n.Icon = "icon"
n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
n.Notify(1)
Catch
If LastException.IsInitialized Then Log(LastException)
End Try
End Sub
Sub Service_Destroy
End Sub