#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
Dim fm As FirebaseMessaging
End Sub
Sub Service_Create
fm.Initialize("fm")
Service.AutomaticForegroundMode=Service.AUTOMATIC_FOREGROUND_ALWAYS
End Sub
Public Sub SubscribeToTopics
fm.SubscribeToTopic("ypiresia") 'you can subscribe to more topics
fm.SubscribeToTopic("anakoinosi")
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
StopService(Me)
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
Dim n As Notification
n.Initialize2(n.IMPORTANCE_DEFAULT)
n.AutoCancel=True
n.Icon = "icon"
n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
Service.StartForeground(1,n)
End Sub
Sub Service_Destroy
End Sub