B4J Tutorial [example] B4X Time Tracker

Discussion in 'B4J Tutorials' started by Erel, Jul 29, 2015.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Time tracker example with a server component and iOS and Android client apps.
    The client apps allow the employees to check in and out (based on the current status).
    upload_2015-7-29_16-5-40.png upload_2015-7-29_16-4-50.png


    [​IMG]

    The server collects all the data in a SQLite db and can print reports with the employee work times.
    As you can see in the code, the B4A and B4i projects are very similar.
    Both use KeyValueStore and HttpUtils2 components.

    The server address is hard coded in the client code. You will need to change it based on your PC address.
    If you run it on Windows then you need to add an incoming rule in Windows firewall. The port is 55555.

    Took me about two and a half hours to write all three components. This is a nice example of the power of B4J, B4A and B4i combined :)
     

    Attached Files:

    Last edited: Jul 29, 2015
    Mark Turney, maXim, rwblinn and 2 others like this.
  2. Peter Simpson

    Peter Simpson Well-Known Member Licensed User

    I'll give it a go shortly, sounds interesting Erel...
     
    Erel likes this.
  3. AzureCrystal

    AzureCrystal Member Licensed User

    B4A newbie here, still pinching myself every time I use this, thank you so much for so many examples and tutorials, and for such a rich, well documented, and well thought out tool. Kudos to you Erel, B4A beats some of the more well established IDEs out there, my hat is off to you! Thank You!

    Note: One question; If I also purchase B4I, is there a lot of code changes from B4A, are there tutorials on that (I bet yes!), thanks in advance...
     
  4. AzureCrystal

    AzureCrystal Member Licensed User

    @Erel - Is there an SQL create script or any directions on setting up the server portion of this example? Grateful thanks in advance...

    P.S. 1st going to check the B4J.zip file, perhaps my answer is there ;)
     
    Last edited: Dec 21, 2015
  5. Cableguy

    Cableguy Expert Licensed User

    Almost all of the non-UI related code can be reused in either IDEs, and most UI code needs little tweaking and adapting... that's what makes this toll so amazing!
     
  6. AzureCrystal

    AzureCrystal Member Licensed User

    Great, having nothing but fun with the product so far ;)
     
  7. AzureCrystal

    AzureCrystal Member Licensed User

    Running Windows 7, I am running the server B4J program, I added the 5555 port as a firewall exception, but I still get this error from the B4A client program, any help will be greatly appreciated :)

    Code:
    org.apache.http.conn.HttpHostConnectException: Connection to http://0.0.0.0:55555 refused
    Interesting - This example works, with 8888 as port:
    http://www.b4x.com/android/forum/threads/server-building-web-servers-with-b4j.37172
     
    Last edited: Dec 21, 2015
  8. AzureCrystal

    AzureCrystal Member Licensed User

    Got it to work, I forgot to add the server's actual ip addy to the client main as follows:
    Code:
    Private const serverAddress As String = "http://xx.0.0.x9:5555"
    it works!
     
  9. AzureCrystal

    AzureCrystal Member Licensed User

    Thanks for the reply!
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    The database is created automatically if it doesn't already exist (see DB.CreateDB).
     
  11. AzureCrystal

    AzureCrystal Member Licensed User

    Thank you Erel, I figured I was missing a server component so I downloaded the B4J code and got it running ;)
     
Loading...