Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
App.RegisterUserNotifications(True, True, True)
App.RegisterForRemoteNotifications
CheckForPushMessage
End Sub
Private Sub CheckForPushMessage
If App.LaunchOptions.IsInitialized And _
App.LaunchOptions.ContainsKey("UIApplicationLaunchOptionsRemoteNotificationKey") Then
Dim data As Object = App.LaunchOptions.Get("UIApplicationLaunchOptionsRemoteNotificationKey")
Dim no As NativeObject = App
no.GetField("delegate").RunMethod("application:didReceiveRemoteNotification:", _
Array(App, data))
End If
End Sub
Private Sub Application_PushToken (Success As Boolean, Token() As Byte)
If Success Then
Dim bc As ByteConverter
parse.Initialize(bc.HexFromBytes(Token),applicationId,restApiKey)
Else
Log("Error getting token: " & LastException)
End If
End Sub
Private Sub Application_RemoteNotification (Message As Map)
Log("Remote notification: " & Message)
Dim m As Map = Message.Get("aps")
Log(m)
Log(m.Get("alert"))
Msgbox("remote: " & Message, "")
End Sub