在线离线Android App中的同步问题

时间:2020-06-17 18:46:03

标签: android sqlite service broadcastreceiver

我正在开发一个应用程序,该应用程序将在网络连接不良的地方使用。 我在本地使用SQLite,在服务器上使用SQL。

几个用户连接到该应用程序。用户应该能够显示用户在线时所做的更改。

Even if the user closes the application, the application sends data to the server.

Even if the application is closed, the application receives data from the server.

我为开发此系统写了前台服务。服务每30秒运行一次。 该服务在首次启动该应用程序时启动。 但这会耗尽系统

然后我搜索了,发现了 WorkManager 。我意识到如果使用 FCM ,我可以在本地更新数据。

如果服务器上的数据发生更改,我可以向应用程序发送通知,并向服务器发送更改后数据的请求。

enter image description here

有没有建议的方法?

对不起,我的语言,谢谢您的宝贵时间。

0 个答案:

没有答案
相关问题