Click here to Skip to main content
13,509,265 members
Click here to Skip to main content
Add your own
alternative version


11 bookmarked
Posted 25 Feb 2013

Simple Sync Apps

, 26 Feb 2013
Rate this:
Please Sign up or sign in to vote.
Synchronizing between Android and desktop

About the Download

The download file is very big, the reason is there are two projects contained inside the zip file. One is a desktop application and the other one is an Android application. 


I began to learn programming half of a years ago and I began to write this application about a month ago. I began from 0 knowledge to network and server. So I couldn’t make sure that I have written a very perfect program. But, this application does exactly what I need for 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 an easier way I know.

Develop Environment

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 zero cost on this project.

Program Flow Chart


The flow chart above shows how data is passing through between Android and desktop.
When user presses a button on UI thread to ask Android, read what desktop has 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, there will be success to access into server, then Android will begin searching the PHP files requested (either update or read PHP files) through HTTP protocol.

Request asks for read database PHP file to work. When read database PHP file is executed, PHP file will begin its work by logging in to database and retrieving the data requested what desktop has written into database. Then, PHP gets the data it wants from database, it will pass it again to Android and Android will get the data and put it on UI thread to show user what data was retrieved from database. If the desktop asks for what Android has written, it (desktop) will do exactly the same things as what Android did. Desktop will go 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 has written into database. After database adapter gets what it wants, it will pass the data to desktop and desktop will put it on screen to show user what data it (desktop) got.

Source Code

  • mysqlAndroid is an Android project. Inside this project, there are three Java source code (JsonParser, JsonPost and MainThread).
  • contains the HttpGet method. There is no input data to URL, only retrieve data from the PHP file.
  • contains the HttpPost method. This method allows data post into PHP file.
  • is a UI thread work that calls the button or textView method allows user talk with machine.
  • mysqlDesktop is a Java Swing project. Inside this project, there are three Java source code files and one external jar that is,, and, and mysql-java Connector.
  • contains the source code that allows Java project to connect to MySQL database.
  • is used to make database work get easier to carry it out.
  • is a source code that allows user to talk with device through Windows Form.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Edison Heng
Japan Japan
Hi! Thank you everyone who reading my article. My major is electronic and programming. Right now I am doing foreign study at Japan. I will like sharing to everyone with my works and if you do interesting with my works, please leave you comment on my blog. Any comments is welcoming.

You may also be interested in...


Comments and Discussions

Questionother ways Pin
Kasra Ahmadi27-Oct-14 4:16
memberKasra Ahmadi27-Oct-14 4:16 
AnswerRe: other ways Pin
Edison Heng27-Oct-14 19:25
memberEdison Heng27-Oct-14 19:25 
GeneralMy vote of 5 Pin
Mihai MOGA11-Mar-13 21:50
memberMihai MOGA11-Mar-13 21:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180417.1 | Last Updated 26 Feb 2013
Article Copyright 2013 by Edison Heng
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid