The download file is very bigger, the reason is there are two project contains inside the zip file. One is desktop application and the other one is android application.
I begin to learn programming is still half of a years ago and I begin to write this application is about one months ago. Begin from 0 knowledge to network and server.
So I couldn’t make sure that I have wrote a very perfect program. But, this application do exactly what I need for that is synchronizing between android and desktop.
It is how the application looks like. Check it out with the following video:
How it works
The picture above shows how the data is transferred. Database server is a bridge to allow data move from android to desktop and move from desktop to android. That’s all, simple right!
Of course that’s other way such as cloud computing or others. Based on my knowledge, this is easier way I know.
My development environment is Java JDK version 1.7.0_13, Eclipse SDK (Juno version 4.2.1), XAMPP 1.8.1, MySQL Connector/J 5.1.23, android 4.2. Because every software I used to develop this application is open-source, I spent a zero cost on this project.
Program Flow Chart
||Flow chart beside shows how data is passing through between android and desktop. |
When user press a button on UI thread to ask android read what desktop have written, android will begin access to MySQL server.
In server side, two PHP files ( update database and read database PHP files) is created and located at htdocs. After android will success to access into server, then android will begin searching the
PHP files requested (either update or read php files) through HTTP protocol.
Request ask for read database PHP file to work. When read database PHP file is executed,
PHP file will begin it’s work by log in to database and retrieve the data requested that what desktop have written into database. After,
PHP get the data it wants from database, it will pass it again to android and android get the data and put it on UI thread to show user what data have retrieved from database. If the desktop ask for what android have written, it (desktop) will do exactly same things as what android did. desktop will going into database adapter request for data it wants. Then database adapter will log in to database server through Java-MySQL connector and search for what android have written into database. After database adapter get what their want, it will pass the data to desktop and desktop will
put it on screen to show user what data it (desktop) got.
- mysqlAndroid is an android project. Inside this project contains three Java source code (JsonParser, JsonPost and MainThread).
- JsonParser.java contains the
HttpGet method. There is no input data to URL, only retrieve data from
the PHP file.
- JsonPost.java contains the
HttpPost method. This method allow data post into PHP file.
- MainThread.java is a UI thread work that called the button or textView method
allow user talk with machine.
- mysqlDesktop is a Java Swing project. Inside this project contains three java source code and one external jar that is
DatabaseAdapter.java, jConnector.java, and MainFrame.java, and mysql-java Connector.
jConnector.java contains the source code that allow java project connect to MySQL database.
DatabaseAdapter.java used to make database work getting easier to carry out.
- MainFrame.java is a source code allow user to talk with device through window form