Android Studio Sample Projects

These are sample test projects, so the project name must be litesync-test for them to work properly.

This limitation is not present on the full libraries.

Native SQLite interface

This sample project uses 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:


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


JNI Interface

This sample project uses a JNI interface based on the Android-sqlite-native-driver



For both projects:

1  Install the modified SQLite shell and the dependencies 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://"