@@ -155,84 +155,27 @@ sqlite3_close(db)
155155
156156### Android Package
157157
158- You can [ add this project as a dependency to your Android project ] ( https://central.sonatype.com/artifact/ai.sqlite/sync ) .
158+ Add the [ following ] ( https://central.sonatype.com/artifact/ai.sqlite/sync ) to your Gradle dependencies:
159159
160- ** Groovy:**
161160``` gradle
162- repositories {
163- google()
164- mavenCentral()
165- maven { url 'https://jitpack.io' }
166- }
167- dependencies {
168- // ...
169- // Use requery's SQLite instead of Android's built-in SQLite to support loading custom extensions
170- implementation 'com.github.requery:sqlite-android:3.49.0'
171- // Both packages below are identical - use either one
172- implementation 'ai.sqlite:sync:0.8.39' // Maven Central
173- // implementation 'com.github.sqliteai:sqlite-sync:0.8.39' // JitPack (alternative)
174- }
161+ implementation 'ai.sqlite:sync:0.8.41'
175162```
176163
177- ** Kotlin:**
178- ``` kotlin
179- repositories {
180- google()
181- mavenCentral()
182- maven(url = " https://jitpack.io" )
183- }
184-
185- dependencies {
186- // ...
187-
188- // Use requery's SQLite instead of Android's built-in SQLite to support loading custom extensions
189- implementation(" com.github.requery:sqlite-android:3.49.0" )
190- // Both packages below are identical - use either one
191- implementation(" ai.sqlite:sync:0.8.39" ) // Maven Central
192- // implementation("com.github.sqliteai:sqlite-sync:0.8.39") // JitPack (alternative)
193- }
194- ```
195-
196- After adding the package, you'll need to [ enable extractNativeLibs] ( https://github.com/sqliteai/sqlite-extensions-guide/blob/18acfc56d6af8791928f3ac8df7dc0e6a9741dd4/examples/android/src/main/AndroidManifest.xml#L6 ) .
197-
198164Here's an example of how to use the package:
199165``` java
200- import android.database.Cursor ;
201- import android.util.Log ;
202- import io.requery.android.database.sqlite.SQLiteCustomExtension ;
203- import io.requery.android.database.sqlite.SQLiteDatabase ;
204- import io.requery.android.database.sqlite.SQLiteDatabaseConfiguration ;
205- import java.util.Collections ;
206-
207- ...
208-
209- private void cloudsyncExtension() {
210- try {
211- SQLiteCustomExtension cloudsyncExtension = new SQLiteCustomExtension (getApplicationInfo(). nativeLibraryDir + " /cloudsync" , null );
212- SQLiteDatabaseConfiguration config = new SQLiteDatabaseConfiguration (
213- getCacheDir(). getPath() + " /cloudsync_test.db" ,
214- SQLiteDatabase . CREATE_IF_NECESSARY | SQLiteDatabase . OPEN_READWRITE ,
215- Collections . emptyList(),
216- Collections . emptyList(),
217- Collections . singletonList(cloudsyncExtension)
218- );
219-
220- SQLiteDatabase db = SQLiteDatabase . openDatabase(config, null , null );
221-
222- Cursor cursor = db. rawQuery(" SELECT cloudsync_version()" , null );
223- if (cursor. moveToFirst()) {
224- String version = cursor. getString(0 );
225- Log . i(" sqlite-sync" , " cloudsync_version(): " + version);
226- }
227- cursor. close();
228- db. close();
229-
230- } catch (Exception e) {
231- Log . e(" sqlite-sync" , " Error: " + e. getMessage());
232- }
233- }
166+ SQLiteCustomExtension cloudsyncExtension = new SQLiteCustomExtension (getApplicationInfo(). nativeLibraryDir + " /cloudsync" , null );
167+ SQLiteDatabaseConfiguration config = new SQLiteDatabaseConfiguration (
168+ getCacheDir(). getPath() + " /cloudsync_test.db" ,
169+ SQLiteDatabase . CREATE_IF_NECESSARY | SQLiteDatabase . OPEN_READWRITE ,
170+ Collections . emptyList(),
171+ Collections . emptyList(),
172+ Collections . singletonList(cloudsyncExtension)
173+ );
174+ SQLiteDatabase db = SQLiteDatabase . openDatabase(config, null , null );
234175```
235176
177+ ** Note:** Additional settings and configuration are required for a complete setup. For full implementation details, see the [ complete Android example] ( https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/android/README.md ) .
178+
236179## Getting Started
237180
238181Here's a quick example to get started with SQLite Sync:
0 commit comments