#Region Project Attributes
#ApplicationLabel: TestLicense
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
Public CAPPLOG As Boolean = False
Private xui As XUI
End Sub
Sub Globals
Private dialog As B4XDialog
End Sub
Sub Activity_Create(FirstTime As Boolean)
dialog.Initialize(Activity)
Dim LifeCycle As Int = 60
DateTime.DateFormat = "MM/dd/yyyy"
Dim LifeStart As Long = DateTime.Dateparse("12/19/2019")
Dim LifeNow As Long = DateTime.Now
Dim RemainDays As Long = LifeCycle - (LifeNow - LifeStart) / 86400000
AppLog("RemainDays: " & RemainDays)
If RemainDays < 0 Then
Dim MsgInfo As String = $"This app is ${NumberFormat(Abs(RemainDays),1,0)} day outdated!
Renew your license now!
More information at:
https://renewyourlicense.com"$
Dim icon As B4XBitmap = xui.LoadBitmapResize(File.DirAssets, "WarningHalt.png", 60dip, 60dip, True)
Dim sf As Object = xui.Msgbox2Async(MsgInfo, "License test", "", "", "OK", icon)
Wait For (sf) Msgbox_Result (Result As Int)
Activity.Finish
ExitApplication
End If
Dim MsgInfo As String = $"Renew your license within ${RemainDays} days!
More information at:
https://renewyourlicense.com"$
Dim icon As B4XBitmap = xui.LoadBitmapResize(File.DirAssets, "WarningSign.png", 60dip, 60dip, True)
Dim sf As Object = xui.Msgbox2Async(MsgInfo, "License test", "", "", "OK", icon)
Wait For (sf) Msgbox_Result (Result As Int)
Activity.LoadLayout("Layout1")
End Sub
Sub Activity_KeyPress (KeyCode As Int)
If KeyCode = KeyCodes.KEYCODE_BACK Then
Dim MsgInfo As String = $"Do you really want to close the application?"$
Dim icon As B4XBitmap = xui.LoadBitmapResize(File.DirAssets, "WarningSign.png", 60dip, 60dip, True)
Dim sf As Object = xui.Msgbox2Async(MsgInfo, "Terminated Application", "Yes", "", "No", icon)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = -1 Then
Activity.Finish
ExitApplication
Else
End If
End If
End Sub
Sub AppLog (sEntry As String)
If CAPPLOG Then
Log(DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.Now) & " - " & sEntry)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub