download file txt, .db , xml file to device external folder. (MAUI)

Sojan 21 Reputation points
2023-02-10T03:12:11.5733333+00:00

How can i download a file to my external folder on Android IOS devices using MAUI application?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,016 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,335 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 49,536 Reputation points Microsoft External Staff
    2023-02-10T06:37:30.2+00:00

    Hello,

    The first is the relatively closed iOS, regarding this feature, iOS does not support you for security reasons.

    In iOS, your app creates its own folders and you can only write files to those folders. Please refer to Application directories.

    When your application is installed on a device, the operating system creates a home directory for your application, and creates a number of directories within the application root directory that are available for use. Since iOS 8, the user-accessible directories are NOT located within the application root, so you can't derive the paths for the application bundle from the user directories, or vice versa.

    For the more open Android system, in fact, after Android 11, the storage mechanism has also been modified similar to iOS. Please refer to Storage updates in Android 11.

    Starting in Android 11, apps cannot create their own app-specific directory on external storage. To access the directory that the system provides for your app, call getExternalFilesDirs().

    Therefore, it is recommended that you store files in an application-specific folder, which is easier to manage and the amount of code will be much reduced.

    Please refer to File system helpers to get more details.

    Best Regards,

    Alec Liu.


    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.