Reputation: 1668
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. How do I modify the content of my backupscheme.xml to set the include path correctly? I prefer to set the db location at runtime.
My backupscheme.xml looks like
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content >
<include domain="database" path="device_info.db"/>
</full-backup-content
My manifest contains:
<application
android:allowBackup="true"
android:icon="@drawable/time_machine_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="mypackage.myapp"
android:fullBackupContent="@xml/backupscheme"
>
Upvotes: 3
Views: 2285
Reputation: 1007554
<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 filenameopenOrCreateDatabase()
with just a plain filenameIn 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.
Upvotes: 4