'Code module
#Region Project Attributes
#ApplicationLabel: B4i Example
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#End Region
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 hd As HUD
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
Page1.RootPanel.LoadLayout("1")
NavControl.ShowPage(Page1)
Dim ln As Notification
Dim no As NativeObject = ln
no.SetField("soundName", "test.wav")
App.RegisterUserNotifications(True, True, True) 'request permission for notifications
App.ApplicationIconBadgeNumber = 0
'check whether the app was started from a notification
If App.LaunchOptions.IsInitialized Then
Dim ln As Notification = App.LaunchOptions.Get("UIApplicationLaunchOptionsLocalNotificationKey")
If ln.IsInitialized Then
hd.ToastMessageShow("Application was started from a notification: " & ln.AlertBody, True)
End If
End If
End Sub
Sub btnNotification_Click
Dim ln As Notification
ln.Initialize(DateTime.Now + 6 * DateTime.TicksPerSecond) '6 seconds from now
ln.IconBadgeNumber = 1
ln.AlertBody = "Moo is hungry"
ln.PlaySound = True
ln.Register
hd.ToastMessageShow("Notification will fire in 6 seconds.", False)
End Sub
Sub Application_ReceiveLocalNotification (LN As Notification)
'this event will fire if the scheduled notification happend when the app was running
hd.ToastMessageShow("Notification arrived: " & LN.AlertBody, True)
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub
Private Sub Application_Background
End Sub