如何使用服务器上的数据在Android的在线应用程序,当应用程序处于脱机状态? [英] How to use server data in android online app-When the app is offline?
问题描述
我正在开发在线应用程序,整个程序是基于服务器的JSON response.Like的Facebook,它会显示已经浏览DATAS当移动不具备互联网连接Twitter应用程序上。
I am developing online android application and the whole app is based on the server JSON response.Like Facebook,twitter application it displays the already browsed datas when the mobile doesn't have the internet connection.
什么是实现最好的办法是??
由于这是我的应用程序的迫切要求。
Because this is the urgent requirement for my app..
推荐答案
有很多方式进入市场。但是这一个简单easy.Using 邮政业
您获取来自服务器的数据,你的应用程序的第一次启动并存储到的SQLite数据库
当无网络可用
获取从 SQLite的数据
并显示it.and当 Internet访问
您允许用户刷新的应用程序,新数据可用
到服务器上,你可以下载新的数据和同步与的SQLite数据库
。
There are many ways into market. but this one is simple and easy.Using Post Services
you fetch data from server at the first start of your app and store into SQLite DB
and when No internet available
fetch data from SQLite
and display it.and when Internet available
you allow the user to refresh the app that New Data available
into server you can download new data and sync with SQLite DB
.
我有 SyncIt 工作同步方面。 SyncIt
是一个库,使您能够轻松地添加同步(离线/现场)的Web应用程序。这可能是用于允许多个用户/设备脱机工作或因为该应用具有实时编辑会话与其他用户。
I have work Synchronization aspect with SyncIt. SyncIt
is a library to enable you to easily add synchronization to your (offline /live) web Apps. This may be for allowing multiple users / devices to work offline or because the app has a live editing session with other users.
这篇关于如何使用服务器上的数据在Android的在线应用程序,当应用程序处于脱机状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!