Xamarin backup sqlite to external storage

Seth Isaacks 11 Reputation points
2022-05-02T23:23:17.667+00:00

Hello, I am wondering if someone can help me. I have an Xamarin Flyout App. I have a local sqlite db that I want to backup to external storage and restore from in the event that say the data on the app has to be cleared. I have googled and googled and googled but I cannot find an answer as to how to accomplish this task. Any help would be much appreciated.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,342 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 72,011 Reputation points Microsoft Vendor
    2022-05-03T02:15:53.603+00:00

    Hello,​

    If Apps that run on Android 11 but Target Framework set to Android 10 (API level 29), you can set the android:requestLegacyExternalStorage="true" attribute in <application> tag.

    If Target Framework set to Android 11, Starting in Android 11, apps cannot create their own app-specific directory on external storage without grand any permission. You can refer to this storage doc in android 11.

    You can try to upload your SQLite DB to Azure Storage and you can download it when you need to use, Azure Storage is a scalable cloud storage solution that can be used to store unstructured, and structured data.

    If you have to request All files access, you can declare the MANAGE_EXTERNAL_STORAGE permission in the manifest and request this permission. For more details, please refer to Manage all files on a storage device

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    MAUI is currently in Preview and not yet supported on Microsoft Q&A. Please post any MAUI questions or feedback in the MAUI repository at https://github.com/dotnet/maui