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"
>
<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 ContextSQLiteOpenHelper 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With