Search code examples
androidandroid-fileandroid-storage

Bundle app with files located in internal storage directory instead of assets directory?


I am building an app which will contain media files that are bundled with the application. Users will also be able to download additional media files at runtime.

I want to store the downloaded files in the application's internal storage directory. Is it possible to "bundle" the initial files in such a way that it is also stored in the internal storage directory, or will I need to place them in assets, and thus have two different ways of accessing my media files?


Solution

  • Is it possible to "bundle" the initial files in such a way that it is also stored in the internal storage directory

    If you are looking to have them be placed there automatically, then no, there is no option for this.

    will I need to place them in assets, and thus have two different ways of accessing my media files?

    You are welcome to copy the assets to the filesystem yourself (see AssetManager). You would treat the filesystem as the "system of record" and only copy things there if needed (e.g., first run of the app, after user does "Clear Data").