Android Studio样本项目
此示例项目使用 SQLite Android Bindings
具有与android.database.sqlite命名空间相同的接口,但有一些小的更改:
1 我们必须先使用以下代码加载本机SQLite库:
System.loadLibrary("litesync");
2 将所有出现的android.database.sqlite改成org.sqlite.database.sqlite。例:
import org.sqlite.database.sqlite.SQLiteDatabase;
3 替换这两个引用:
android.database.SQLException android.database.DatabaseErrorHandler
换成这样:
org.sqlite.database.SQLException org.sqlite.database.DatabaseErrorHandler
Sample Project
使用说明
1 在计算机上安装 LiteSync
2 启动一个SQLite Shell作为绑定到TCP地址的主节点
3 修改TCP地址以连接到项目代码
4 在模拟器或设备上构建并运行项目
要在主节点上打开数据库,我们使用如下命令:
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.