# SQLiteDatabase.OpenParams.Builder

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.OpenParams.Builder "View this page in Java")  

```
class Builder
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                         ||
| ↳ | [android.database.sqlite.SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) |

Builder for [OpenParams](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams).

## Summary

|                                                                                                                                                          Public constructors                                                                                                                                                           ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#Builder())`()` <br />                                                                                                                                                                                            |
| [Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#Builder(android.database.sqlite.SQLiteDatabase.OpenParams))`(`params:` `[SQLiteDatabase.OpenParams](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams)!`)` <br /> |

|                                                                                                                                                                                                                                                                                                               Public methods                                                                                                                                                                                                                                                                                                               ||
|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)  | [addOpenFlags](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#addOpenFlags(kotlin.Int))`(`openFlags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Adds flags to control database access mode                                                                                                                                                                                                 |
| [SQLiteDatabase.OpenParams](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams)                   | [build](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#build())`()` Creates an instance of [OpenParams](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams) with the options that were previously set on this builder                                                                                                                                                             |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)  | [removeOpenFlags](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#removeOpenFlags(kotlin.Int))`(`openFlags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Removes database access mode flags                                                                                                                                                                                                   |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)  | [setCursorFactory](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#setCursorFactory(android.database.sqlite.SQLiteDatabase.CursorFactory))`(`cursorFactory:` `[SQLiteDatabase.CursorFactory](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.CursorFactory)?`)` Set an optional factory class that is called to instantiate a cursor when query is called.                                 |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)  | [setErrorHandler](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#setErrorHandler(android.database.DatabaseErrorHandler))`(`errorHandler:` `[DatabaseErrorHandler](https://developer.android.com/reference/kotlin/android/database/DatabaseErrorHandler.html#)?`)` Sets [DatabaseErrorHandler](https://developer.android.com/reference/kotlin/android/database/DatabaseErrorHandler.html#) object to handle db corruption errors |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)  | [setIdleConnectionTimeout](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(kotlin.Long))`(`idleConnectionTimeoutMs:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Sets the maximum number of milliseconds that SQLite connection is allowed to be idle before it is closed and removed from the pool.                                                               |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)  | [setJournalMode](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#setJournalMode(kotlin.String))`(`journalMode:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Sets [journal mode](https://sqlite.org/pragma.html#pragma_journal_mode) to use.                                                                                                                                             |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)! | [setLookasideConfig](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#setLookasideConfig(kotlin.Int,%20kotlin.Int))`(`slotSize:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `slotCount:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Configures [lookaside memory allocator](https://sqlite.org/malloc.html#lookaside)                                      |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)  | [setOpenFlags](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#setOpenFlags(kotlin.Int))`(`openFlags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets flags to control database access mode                                                                                                                                                                                                 |
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#)  | [setSynchronousMode](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#setSynchronousMode(kotlin.String))`(`syncMode:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Sets [synchronous mode](https://sqlite.org/pragma.html#pragma_synchronous)                                                                                                                                             |

## Public constructors

### Builder

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder()
```  

### Builder

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(params: SQLiteDatabase.OpenParams!)
```

## Public methods

### addOpenFlags

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addOpenFlags(openFlags: Int): SQLiteDatabase.OpenParams.Builder
```

Adds flags to control database access mode

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `openFlags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new flags to add Value is either `0` or a combination of [android.database.sqlite.SQLiteDatabase#OPEN_READWRITE](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#OPEN_READWRITE:kotlin.Int), [android.database.sqlite.SQLiteDatabase#OPEN_READONLY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#OPEN_READONLY:kotlin.Int), [android.database.sqlite.SQLiteDatabase#CREATE_IF_NECESSARY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#CREATE_IF_NECESSARY:kotlin.Int), [android.database.sqlite.SQLiteDatabase#NO_LOCALIZED_COLLATORS](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#NO_LOCALIZED_COLLATORS:kotlin.Int), android.database.sqlite.SQLiteDatabase.NO_DOUBLE_QUOTED_STRS, and [android.database.sqlite.SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING:kotlin.Int) |

|                                                                                                                         Return                                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) | same builder instance for chaining multiple calls into a single statement This value cannot be `null`. |

### build

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): SQLiteDatabase.OpenParams
```

Creates an instance of [OpenParams](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams) with the options that were previously set on this builder

|                                                                           Return                                                                            ||
|-------------------------------------------------------------------------------------------------------------------------------|------------------------------|
| [SQLiteDatabase.OpenParams](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams) | This value cannot be `null`. |

### removeOpenFlags

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun removeOpenFlags(openFlags: Int): SQLiteDatabase.OpenParams.Builder
```

Removes database access mode flags

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `openFlags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Flags to remove Value is either `0` or a combination of [android.database.sqlite.SQLiteDatabase#OPEN_READWRITE](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#OPEN_READWRITE:kotlin.Int), [android.database.sqlite.SQLiteDatabase#OPEN_READONLY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#OPEN_READONLY:kotlin.Int), [android.database.sqlite.SQLiteDatabase#CREATE_IF_NECESSARY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#CREATE_IF_NECESSARY:kotlin.Int), [android.database.sqlite.SQLiteDatabase#NO_LOCALIZED_COLLATORS](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#NO_LOCALIZED_COLLATORS:kotlin.Int), android.database.sqlite.SQLiteDatabase.NO_DOUBLE_QUOTED_STRS, and [android.database.sqlite.SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING:kotlin.Int) |

|                                                                                                                         Return                                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) | same builder instance for chaining multiple calls into a single statement This value cannot be `null`. |

### setCursorFactory

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setCursorFactory(cursorFactory: SQLiteDatabase.CursorFactory?): SQLiteDatabase.OpenParams.Builder
```

Set an optional factory class that is called to instantiate a cursor when query is called.

|                                                                                        Parameters                                                                                         ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cursorFactory` | [SQLiteDatabase.CursorFactory](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.CursorFactory)?: instance This value may be `null`. |

|                                                                                                                         Return                                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) | same builder instance for chaining multiple calls into a single statement This value cannot be `null`. |

### setErrorHandler

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setErrorHandler(errorHandler: DatabaseErrorHandler?): SQLiteDatabase.OpenParams.Builder
```

Sets [DatabaseErrorHandler](https://developer.android.com/reference/kotlin/android/database/DatabaseErrorHandler.html#) object to handle db corruption errors

|                                                                           Parameters                                                                           ||
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| `errorHandler` | [DatabaseErrorHandler](https://developer.android.com/reference/kotlin/android/database/DatabaseErrorHandler.html#)?: This value may be `null`. |

|                                                                                    Return                                                                                    ||
|------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) | This value cannot be `null`. |

### setIdleConnectionTimeout

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setIdleConnectionTimeout(idleConnectionTimeoutMs: Long): SQLiteDatabase.OpenParams.Builder
```

**Deprecated:** *DO NOT USE this method. See the javadoc for the details.*

Sets the maximum number of milliseconds that SQLite connection is allowed to be idle before it is closed and removed from the pool.

**DO NOT USE** this method. This feature has negative side effects that are very hard to foresee.

A connection timeout allows the system to internally close a connection to a SQLite database after a given timeout, which is good for reducing app's memory consumption. **However** the side effect is it **will reset all of SQLite's per-connection states** , which are typically modified with a `PRAGMA` statement, and these states **will not be restored** when a connection is re-established internally, and the system does not provide a callback for an app to reconfigure a connection. This feature may only be used if an app relies on none of such per-connection states.

|                                                                                                                                                 Parameters                                                                                                                                                  ||
|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `idleConnectionTimeoutMs` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): timeout in milliseconds. Use [Long.MAX_VALUE](https://developer.android.com/reference/kotlin/java/lang/Long.html#MAX_VALUE:kotlin.Long) to allow unlimited idle connections. Value is 0 or greater |

|                                                                                    Return                                                                                    ||
|------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) | This value cannot be `null`. |

**See Also**

- [android.database.sqlite.SQLiteOpenHelper#setIdleConnectionTimeout(long)](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteOpenHelper#setIdleConnectionTimeout(kotlin.Long))  

### setJournalMode

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setJournalMode(journalMode: String): SQLiteDatabase.OpenParams.Builder
```

Sets [journal mode](https://sqlite.org/pragma.html#pragma_journal_mode) to use.

Note: If journal mode is not set, the platform will use a manufactured-specified default which can vary across devices.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ||
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `journalMode` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): Value is [android.database.sqlite.SQLiteDatabase#JOURNAL_MODE_WAL](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#JOURNAL_MODE_WAL:kotlin.String), [android.database.sqlite.SQLiteDatabase#JOURNAL_MODE_PERSIST](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#JOURNAL_MODE_PERSIST:kotlin.String), [android.database.sqlite.SQLiteDatabase#JOURNAL_MODE_TRUNCATE](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#JOURNAL_MODE_TRUNCATE:kotlin.String), [android.database.sqlite.SQLiteDatabase#JOURNAL_MODE_MEMORY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#JOURNAL_MODE_MEMORY:kotlin.String), [android.database.sqlite.SQLiteDatabase#JOURNAL_MODE_DELETE](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#JOURNAL_MODE_DELETE:kotlin.String), or [android.database.sqlite.SQLiteDatabase#JOURNAL_MODE_OFF](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#JOURNAL_MODE_OFF:kotlin.String) This value cannot be `null`. |

|                                                                                    Return                                                                                    ||
|------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) | This value cannot be `null`. |

### setLookasideConfig

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setLookasideConfig(
    slotSize: Int, 
    slotCount: Int
): SQLiteDatabase.OpenParams.Builder!
```

Configures [lookaside memory allocator](https://sqlite.org/malloc.html#lookaside)

SQLite default settings will be used, if this method isn't called. Use `setLookasideConfig(0,0)` to disable lookaside

**Note:** Provided slotSize/slotCount configuration is just a recommendation. The system may choose different values depending on a device, e.g. lookaside allocations can be disabled on low-RAM devices

|                                                                                     Parameters                                                                                     ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `slotSize`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The size in bytes of each lookaside slot. Value is 0 or greater                           |
| `slotCount` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The total number of lookaside memory slots per database connection. Value is 0 or greater |

### setOpenFlags

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setOpenFlags(openFlags: Int): SQLiteDatabase.OpenParams.Builder
```

Sets flags to control database access mode

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `openFlags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new flags to set Value is either `0` or a combination of [android.database.sqlite.SQLiteDatabase#OPEN_READWRITE](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#OPEN_READWRITE:kotlin.Int), [android.database.sqlite.SQLiteDatabase#OPEN_READONLY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#OPEN_READONLY:kotlin.Int), [android.database.sqlite.SQLiteDatabase#CREATE_IF_NECESSARY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#CREATE_IF_NECESSARY:kotlin.Int), [android.database.sqlite.SQLiteDatabase#NO_LOCALIZED_COLLATORS](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#NO_LOCALIZED_COLLATORS:kotlin.Int), android.database.sqlite.SQLiteDatabase.NO_DOUBLE_QUOTED_STRS, and [android.database.sqlite.SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING:kotlin.Int) |

|                                                                                                                         Return                                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) | same builder instance for chaining multiple calls into a single statement This value cannot be `null`. |

**See Also**

- [#OPEN_READWRITE](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#OPEN_READWRITE:kotlin.Int)
- [#OPEN_READONLY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#OPEN_READONLY:kotlin.Int)
- [#CREATE_IF_NECESSARY](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#CREATE_IF_NECESSARY:kotlin.Int)
- [#NO_LOCALIZED_COLLATORS](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#NO_LOCALIZED_COLLATORS:kotlin.Int)
- [#ENABLE_WRITE_AHEAD_LOGGING](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING:kotlin.Int)  

### setSynchronousMode

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setSynchronousMode(syncMode: String): SQLiteDatabase.OpenParams.Builder
```

Sets [synchronous mode](https://sqlite.org/pragma.html#pragma_synchronous)

Note: If sync mode is not set, the platform will use a manufactured-specified default which can vary across devices.

|                                                                                                                                                                                                                                                                                                                                                                                                                          Parameters                                                                                                                                                                                                                                                                                                                                                                                                                           ||
|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `syncMode` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): Value is [android.database.sqlite.SQLiteDatabase#SYNC_MODE_EXTRA](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#SYNC_MODE_EXTRA:kotlin.String), [android.database.sqlite.SQLiteDatabase#SYNC_MODE_FULL](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#SYNC_MODE_FULL:kotlin.String), [android.database.sqlite.SQLiteDatabase#SYNC_MODE_NORMAL](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#SYNC_MODE_NORMAL:kotlin.String), or [android.database.sqlite.SQLiteDatabase#SYNC_MODE_OFF](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase#SYNC_MODE_OFF:kotlin.String) This value cannot be `null`. |

|                                                                                    Return                                                                                    ||
|------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|
| [SQLiteDatabase.OpenParams.Builder](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.OpenParams.Builder#) | This value cannot be `null`. |