### Create Non-UI App

To create a Non-UI Application, see this tutorial:
http://www.b4x.com/android/forum/threads/non-ui-applications.34657/
Additional Hints
To use the jShell Library ensure to include StartMessageLoop.
Example Project
' Show the local IP address and JRE Version using API methods (requires the JavaObject library).
' Execute from the command line:
' java -cp b4jhowtoconsole.jar b4j.example.main
' Output sample:
' 07/19/2014 14:22:50
' Device Local IP address:192.168.178.33
' Java JRE Version: 1.8.0_05
`Sub Process_Globals
End Sub`
`Sub AppStart (Args() As String)
Log(DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.Now))
Log("Device Local IP address:" & getLocalIP)
Log("Java JRE Version: " & getJREVersion)
End Sub`
' Returns the local IP address for this client
`Sub getLocalIP As String
Dim JO As JavaObject
Return JO.InitializeStatic("java.net.InetAddress").RunMethodJO("getLocalHost", Null).RunMethod("getHostAddress", Null)
End Sub`
`Sub getJREVersion As String
Dim JO As JavaObject
Return JO.InitializeStatic("java.lang.System").RunMethod("getProperty", Array As Object("java.version"))
End Sub`
Example handling Command Line Arguments
Region Project Attributes
#CommandLineArgs: 2000, S
...
End Region
`Sub Process_Globals
Private CPOLLINGFREQUENCY As Int = 120000 ' Default is 2 min
Private CSHOWFROM As Boolean = False
...
End Sub`
`Sub AppStart (Args() As String)
For i = 0 To Args.Length -1
Log(Args(i))
Next
If Args.Length > 0 Then
If IsNumber(Args(0)) Then CPOLLINGFREQUENCY = Args(0)
If Args.Length = 2 AND Args(1).ToLowerCase = "s" Then CSHOWFROM = True
End If
Log(CPOLLINGFREQUENCY & ", " & CSHOWFROM)
...
`

Changed: , Category: Application, File: T6C159M1148.htm, ID: 1148