在Android中将SQLite数据库与远程MySQL数据同步 [英] Syncing SQLite database with remote mysql data in android

查看:658
本文介绍了在Android中将SQLite数据库与远程MySQL数据同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在android中同步SQLite数据库和远程MySQL数据? 为了清楚起见,我想知道sqlite数据和远程mysql之间的同步是如何工作的.即,当更新远程mySQL数据库时,是否还应该在不按下任何按钮或向下滚动的情况下更新SQLite数据?如何使用Android Studio和Wamp服务器实现该功能? 预先感谢!

How to synchronise SQLite database and remote MySQL data in android? To make it clear, I want to know how syncing between sqlite data and remote mysql works .. i.e., when the remote mySQL database is updated, SQLite data should also be updated without any button press or scroll down? How can I implement that using Android Studio and Wamp server ? Thanks in advance!

推荐答案

我想您可以在android应用程序的服务中使用广播接收器.如果没有,您可以编写服务,并且可以在服务内部使用计时器将http请求发送到服务器并保持同步.要了解有关将SQlite数据库与远程mysql数据库同步的知识,请参考本教程,如果您需要在不按任何按钮的情况下进行操作,则可以在服务内的以下教程中实现代码,并记住使用计时器. 教程链接

I guess you can use broadcast receiver inside a service of your android application. If not you can write a service and inside the service you can use a timer to send http request to the server and keep syncing. To get a knowledege about syncing a SQlite database with remote mysql database refer to this tutorial and if you need it to happen without a button press then implement the code in the following tutorial inside a service and remember to use a timer. TUTORIAL LINK

这篇关于在Android中将SQLite数据库与远程MySQL数据同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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