我怎样才能同步我的Andr​​oid SQLite数据库使用JSON服务器上的数据库? [英] How can I sync my Android SQLite database with a database on a server using json?

查看:129
本文介绍了我怎样才能同步我的Andr​​oid SQLite数据库使用JSON服务器上的数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SQLite数据库Android应用程序。我想要同步的数据库的内容与一个PHP的服务器上,使用JSON。我有服务器的登录名和地址,所以我只需要启动的方式。 如何连接?我需要决定协议,如HTTP或HTTPS?

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?

什么是第一步?

我用这样的:

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?

推荐答案

下面是使用Android的 SyncAdapter 的框架,设计用于同步远程数据源向设备

Here is an example using the Android SyncAdapter framework, designed for syncing remote sources to the device.

这篇关于我怎样才能同步我的Andr​​oid SQLite数据库使用JSON服务器上的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆