Click here to Skip to main content
Click here to Skip to main content

Simple Sync Apps

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

About Download

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. 

Introduction 

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

sync_pic1

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.

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

Program Flow Chart

sync_pic2 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.

Source Code

  • 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

License

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.

Comments and Discussions

 
GeneralMy vote of 5 PinmemberMihai MOGA11-Mar-13 21:50 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 26 Feb 2013
Article Copyright 2013 by Edison Heng
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid