This is an example of building a data collection solution. The solution is made of three components:
- (B4J) Server - Manages the data in a SQLite database.
- (B4A) Device client and (B4J) desktop client - Send new data to the server and show reports.
Note that you can also see the reports from any browser.
In this example we want to track animals. The following type is declared in all three projects:
Animal objects are sent to the server. This is done with RandomAccessFile as explained here:
Send and receive objects
Both the server and the clients are pretty simple (check the code!).
As we are using SQLite database we set the handlers to be single threaded and thus avoid issues with concurrent transactions.
You can make the server accessible over the internet by following the steps described here:
Upload files from your B4A app to your B4J server over the internet
If you run it in the local network then you only need to open the firewall port (51042 in this example) to incoming connections.
- (B4J) Server - Manages the data in a SQLite database.
- (B4A) Device client and (B4J) desktop client - Send new data to the server and show reports.
Note that you can also see the reports from any browser.
In this example we want to track animals. The following type is declared in all three projects:
B4X:
Type Animal (Name As String, Age As Double, Location As String, Date As Long)
Animal objects are sent to the server. This is done with RandomAccessFile as explained here:
Send and receive objects
Both the server and the clients are pretty simple (check the code!).
As we are using SQLite database we set the handlers to be single threaded and thus avoid issues with concurrent transactions.
You can make the server accessible over the internet by following the steps described here:
Upload files from your B4A app to your B4J server over the internet
If you run it in the local network then you only need to open the firewall port (51042 in this example) to incoming connections.
Attachments
Last edited: