Skip to content Skip to sidebar Skip to footer

Automatically Backing Up Sqlite Database

My app uses a small SQLite database that I'd like to have backed up. I'm assuming this won't happen automatically, without my coding for it using fullBackupContent, shown below. Ho

Solution 1:

<include domain="database"path="device_info.db"/>

Here, the domain indicates the root directory in which the path is interpreted. database maps to where SQLite databases are stored by default, if you use:

  • getDatabasePath() on Context
  • SQLiteOpenHelper with just a plain filename
  • openOrCreateDatabase() with just a plain filename

In that case, the filename should be your path value.

If your database is stored somewhere else for some reason, the <include> directive would need some adjustment.

Post a Comment for "Automatically Backing Up Sqlite Database"