Sub Process_Globals
Private fm As FirebaseMessaging
End Sub
'Called when an intent is received.
'Do not assume that anything else, including the starter service, has run before this method.
Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent)
If FirstTime Then
fm.Initialize("fm") 'Crash happens here'
End If
fm.HandleIntent(StartingIntent)
End Sub
Public Sub SubscribeToTopics(topic As String)
fm.SubscribeToTopic(topic) 'you can subscribe to more topics
End Sub
public Sub UnsubscribeFromTopics(topic As String)
fm.UnsubscribeFromTopic(topic)
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
Dim n As NB6
n.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(LoadBitmap(File.DirAssets, "Notification.png"))
n.Build(Message.GetData.Get("title"), Message.GetData.Get("body"), DateTime.Now, Me).Notify(DateTime.Now) 'It will be Main (or any other activity) instead of Me if called from a service.
End Sub