Main
Sub Process_Globals
....
Public Server As ABMServer
....
Public srvr As Server
....
Sub AppStart (Args() As String)
Realstart
StartMessageLoop
End Sub
'This required because of:
'https://www.b4x.com/android/forum/threads/wait-for-not-work-as-in-documentation.146663/post-929835
'You must have a StartMessageLoop in a console app and you cannot use Wait For
'or Sleep inside AppStart (in console app)
'and "console app" = "non-UI app"
Sub Realstart
....
'Whatever ABMServer initialization you require, e.g.:
Private DonatorKey As String = ""
Server.Initialize("", DonatorKey, "start")
'Server.Port = 51042
Server.PortSSL = 51044
'If user needs to login, set to true - CheckLogin() method will be
'called if user tries to login
Server.NeedsAuthorization = False
'First page of app
Server.StartPage = "start_page"
Server.CacheScavengePeriodSeconds = 15 * 30 ' 15 minutes
Server.SessionMaxInactiveIntervalSeconds = 30 * 60 ' 30 minutes
' Server.UploadFolder = "uploads"
' Server.UploadMaxSize = 1024 * 1024
'And finally...
srvr = Server.srvr