'Syncing SQLite with SQLServer using Sync Framework

I'm trying to make an online application which can sync the SQLite database running on an Android device with the SQL running on the server. We have an enterprise app running on .NET and Android; we need to sync their data to retain consistency. It will be a bi-directional sync: any data changes which occur (either on the client or on the database server) should be synced.

I saw that this can be achieved with many approaches but for this scenario I'm advised to use the Microsoft Sync Framework since it automates the sync process and can be handy as well. I did some research on using the Sync framework and found some samples on the Microsoft site. But mostly they are doing offline synchronization: they are basically doing the sync process on the desktop where source and target databases are on the same machine. But for my scenario, this is not the case. I have SQLite on the client machine and SQL on the server so here an online sync process seems to be required.

How should I achieve this?



Solution 1:[1]

they are sample apps, so for simplicity, they just point both source and target databases locally. there's no stopping you from repointing database connections to a remote server.

instead of looking at Sync Framework SDK alone, look at the Sync Framework Toolkit instead. That's the one that addresses non-MS client platforms.

Solution 2:[2]

The Microsoft Sync Services work with any data source that can be connected by the ADO.NET data provider. You will want to look at how to do a peer-to-peer synchronization. The rules for Microsoft Sync Framework are kept in a SQL Server Compact Edition database, and needs to reside on the SQL Server side, and most likely you will perform the synchronization over a network connection (Internet) so you will need to set up a web server and web services to activate the sync agent from the Android side. Making the agent and the sync adapters will be quite a bit of work. Lucky for you enterprising developers have already done this work: https://ampliapps.com/sqlite-sync/ There are other tools like the one I posted, and for transparency sake I have no interests in Ampliapps, I just know of their product.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JuneT
Solution 2 code4mobile