Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private Page2 As Page
Private fm As FirebaseMessaging
Dim IsActive As Boolean
End Sub
Private Sub Application_Start (Nav As NavigationController)
'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
App.RegisterUserNotifications(True, True, True)
App.RegisterForRemoteNotifications
fm.Initialize("fm")
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub
Private Sub fm_FCMConnected
fm.SubscribeToTopic("ios_news") 'add ios_ prefix to all topics
End Sub
Private Sub Application_RemoteNotification (Message As Map, CompletionHandler As CompletionHandler)
If IsActive Then
Log("ignore")
Return
End If
Dim intID As Int = 0
intID = Message.Get("newsid")
NavControl.ShowPage(Page2)
CompletionHandler.Complete
End Sub
Private Sub Application_Active
fm.FCMConnect 'should be called from Application_Active
IsActive = True
End Sub
Private Sub Application_Background
IsActive = False
fm.FCMDisconnect 'should be called from Application_Background
End Sub
Sub Application_PushToken (Success As Boolean, TOKEN() As Byte)
End Sub
Sub Application_Inactive
End Sub
Sub Application_Foreground
End Sub