Android Studio
LiteSync can be used on Android via the SQLite Android Bindings
Is has the same interface as the android.database.sqlite namespace with some minor changes:
1 We must load the native SQLite library before using it using this code:
System.loadLibrary("litesync");
2 Replace all occurrences of android.database.sqlite with org.sqlite.database.sqlite. Example:
import org.sqlite.database.sqlite.SQLiteDatabase;
3 Replace these two references:
android.database.SQLException android.database.DatabaseErrorHandler
by these:
org.sqlite.database.SQLException org.sqlite.database.DatabaseErrorHandler
Sample Project
Instructions
1 Install LiteSync on a computer
2 Start a SQLite shell as the primary node binding to a TCP address
3 Modify the TCP address to connect to on the project code
4 Build and run the project on the simulator or device
To open the database on the primary node we use a command like this:
sqlite3 "file:test.db?node=primary&bind=tcp://0.0.0.0:1234"
Limitations
This sample project includes the free version of LiteSync. It can be upgraded to the full version by replacing the aar file.