Syncing SQLite database with remote mysql data in android

后端 未结 2 1487
礼貌的吻别
礼貌的吻别 2021-02-10 14:05

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 r

2条回答
  •  野性不改
    2021-02-10 14:16

    I don't know any way to make a mirror of your mysql database on your android's sqlite database. There are two ways I can think off when it comes to synchronizing data on your phone. The first one is by using a syncadapter. But this will only pull the data from the server and so you won't have your synchronization as soon as an update is done.

    The second one is by using push notifications. With FCM, firebase cloud messaging, or GCM, google cloud messaging, you can tell your server to send a message to every phone that is connected to it. Your phone can then handle the message and synchronize itself with your database. Obvisouly in either solutions you won't have a direct access to your database as it brings huge security problems so you'll need to pass by a web server with an API to connect your application to your database.

    Here are some useful links about FCM, Syncadapters, etc

提交回复
热议问题