问题
I have an Android app with a sqlite db. I want to sync the content of the database with one on a php server, using json. I have the login and address of the server, so I need just the way to start. How do I connect? Do I need to decide protocol, like http or https?
What is the first step?
I use this:
TelephonyManager tManager = (TelephonyManager)this.mCtx.getSystemService(Context.TELEPHONY_SERVICE);
String uid = tManager.getDeviceId();
To get a unique identifier to be sent with the request.
If I have a url, is this a way to go:
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);?
Any inputs or good tutorials that take if from the beginning?
回答1:
Here is an example using the Android SyncAdapter framework, designed for syncing remote sources to the device.
来源:https://stackoverflow.com/questions/6314977/how-can-i-sync-my-android-sqlite-database-with-a-database-on-a-server-using-json