question

BrianKramer-3128 avatar image
0 Votes"
BrianKramer-3128 asked LeonLu-MSFT commented

Android auto backup rules and sqlite in xamarin.forms

I added the following to auto_backup_rules.xml

 <?xml version="1.0" encoding="UTF-8"?>
 <full-backup-content xmlns:tools="http://schemas.android.com/tools">
     <include domain="sharedpref" path="." />
     <include domain="database" path="SWLogBook.db3" />
     <exclude domain="sharedpref" path="${applicationId}.xamarinessentials.xml" />
     <exclude domain="sharedpref" path="AppCenter.xml" />
     <exclude domain="database" path="com.microsoft.appcenter.persistence" />
     <exclude domain="database" path="com.microsoft.appcenter.persistence-journal" />
     <exclude domain="file" path="error" tools:ignore="FullBackupContent" />
     <exclude domain="file" path="appcenter" tools:ignore="FullBackupContent" />
 </full-backup-content>


but my db defined by:

 string sqliteFilename = "SWLogBook.db3";
             string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder
             string path = Path.Combine(documentsPath, sqliteFilename);

is still not backed up.

Any ideas what I'm doin g wrong?

dotnet-xamarin
· 10
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I test string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder, returned path is /data/user/0/com.companyname.app1/files/

So, you need to change the SQLite DB's domain to file like following code.


<include domain="file" path="SWLogBook.db3" />
0 Votes 0 ·

the above change did not work.

0 Votes 0 ·
LeonLu-MSFT avatar image LeonLu-MSFT BrianKramer-3128 ·

Can you share your AndroidManifest.xml? The amount of data is limited to 25MB per user of your app. There's no charge for storing backup data. Your app can customize the backup process or opt out by disabling backups.https://developer.android.com/guide/topics/data/autobackup

0 Votes 0 ·
Show more comments

0 Answers