I want to store some files when I develop an android app. There are two ways to store the files: use internal directory or use external directory.
As far as I am concerned, if the developers don't want their users or other apps can get access to the files, the file should be stored in internal directories. And if the developers do want the files can be accessed by users or other apps, the file would be stored in external directory.
And here is my question:
when choosing to store files in external directories, should I classify the types of files and store them in different directories like 'Download', 'Movies', 'Picture' ... or make a single directory for my app and store all my files in that directory.
As an android phone user, I don't like the second solution. So I am wondering why so many apps (such as Evernote) choose to create a directory in my external directory, '/sdcard'.
I would say if the files are of interest for the user or other applications store it in a type specific directory.
The second approach, one directory per app, can be used for files that are kind of private to the application. Many devices have more space available in external storage than in internal storage. An application may therefore choose to put its files there even if they are internal in nature.
Related
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?
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").
My question is pretty general; whenever an android app accesses internal storage environment path; its folder structure is created into device's "Android->Data->app_pakage".
Image files within this folder won't be viewed from gallery; which is fine.
There are lots of app which secures this files (Can't be opened directly from file manager);
Examples for this are music apps; they provide encoding of its downloaded files, so it can be accessed only from that app only. This encoding changes its extension
So my question is here, How this can be achieved?. I am looking for simplest solution, which don't require a high, complex encryption algorithms.
In-Short, I want to prevent users to access app files from file manager- internal storage
Please have a look at this link
https://developer.android.com/training/data-storage/files.html
Here there is detailed explanation.
To have files that can only be accessed from your app please use -
getFilesDir()
Returns a File representing an internal directory for your app.
Files saved here are accessible by only your app.
I would like to know if it is possible to set the permissions of the files that my Android app writes on behalf of the user in the external storage folder (that is the common user folders that are accessible to my app like "Documents") so that those files are not writable by other applications that know where they are or explore the external storage folders to find them.
I mean, if my application has many installations and it becomes the target of malware apps, and it has a known user files folder, the malware could change or delete those files (json and other types like txt, doc). I would like that it is not possible by means of file permissions setting.
But note that the user has to be able to manage those files and also edit them.
Even my app sends intents so other apps edit them.
Is it possible?
That is not possible. If you do not want other apps to have access to the files, put them on internal storage, not external storage.
You can create encrypted storage with consistency checking instead of using permissions, what is not possible.
I am writing a file encryption app.
I set up the file(s) browse code using the default storage directory.
This works great, I wrote the code to be able to encrypt multiple files as well as directories.
Directories simply get copied, and the files within are encrypted into a new directory.
The problem is now after some research I have found that I need to utilize the storage access framework to be able to select files from external sd cards, and any other storage system the user may have.
My question is, is there a way to select multiple files and folders simultaneously through activities in the saf? Is there a workaround for this? I found an activity that is able to select multiple files, and I found one that allowed me to select a single directory.
What is the best way to store sound files (ogg) that are distributed with the app and updated at runtime?
I am developing an app that includes a default set of sounds as resources (res/raw/*.ogg). These work fine for the defaults but I want the user to be able to update the set of sounds with recorded sounds and downloads from the Internet. The problem is that the resources are read-only and, I think, assets are also read-only. I don't know how to include files in the project so they can be updated at runtime.
I can have the defaults as resources and files added at runtime on internal storage or SD Card, but I would prefer to have all the files in one place with a single interface for accessing them. Is there a way to include files in the project so they are written to internal storage or SD Card when the app is installed? Or is there a better place to put the files?
Put your files in /asset directory when packaging the .apk file. At runtime copy those files in application's internal storage /data/data/<application_package_name>/files (If files are not to much sized, It useful when device has no external storage included). Also update the files in same location..