mysql通知应用程序数据变化,MySql数据库服务器上的数据更改时如何在Android应用程序中同步SQLite数据库...

该博客探讨了如何在Android应用中高效地同步SQLite数据库与服务器的REST API数据,特别是当服务器上的数据更新时。作者提出问题,当Note2在服务器上被修改时,如何最小化网络调用来同步更新,并考虑使用静默推送通知在应用下次启动时同步。建议尝试使用Android SyncAdapter来解决此问题。
摘要由CSDN通过智能技术生成

In my app, I have to consume REST API for syncing data between server and SQLite DB in app.

I have one activity like To-Do's in which all the To-Do's post on server will notify by the push notification to app. Now, lets check senario.

Senario 1

There are 3 To Do 's on server

- Note 1

- Note 2

- Note 3

There are three To Do's on ther server and all of them are synced and stored in SQLite in the app. And only new notes are synced in the app by requesting for new notes using timestamp stored in SharedPrefs when user opens the app. But, what if -Note 2 is altered on server(MySql DB) than,

- How to sync the updated or deleted notes in app with minimum N/W calls.

- Can we fire push notifs(silently) to inform the app there is altered data on server, so it can be synced on next startup of the app.

I have search for this problem but cannot find appropriate solution.

解决方案

There is very Good Topic in android Sync Adapter. Its worth giving it a try. See the reference link from Android Developer website

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值