Android: make the folder on external memory private or protected

I want to make a folder on external memory (maybe on an SD card) confidential or secure, so that only my application / process can access this folder.

Can I do it? if yes, please let me know?

my requirement: I can use the internal memory of Android to store the files / data of the application, but this can reduce the internal memory of the phone (which can cause problems, such as lack of space for installing other applications, etc.).

+4
source share
4 answers

External storage data cannot be private. It is readable in the world and can be changed by the user if it includes a USB drive.

Quote from developer.android.com:

Each Android-compatible device supports a common "external memory" that you can use to save files. This can be removable media (such as an SD card) or internal (non-removable) storage. Files stored in external storage are read in the world and can be changed by the user when the USB mass memory is turned on to transfer files to the computer.

+1
source

You can not. You can archive the folder and save it as a mail file with the extension.

+1
source

Since API 9 has for this purpose

File.setWritable (boolean, boolean)

as well as for the read / exec operation. take a look at the link

0
source

quote from android docs:

public abstract File getExternalFilesDir (String type)

Since: API level 8 Returns the absolute directory path to an external file system (that is, somewhere on Environment.getExternalStorageDirectory ()), where the application can host persistent files that it owns.

These files are application-specific and are usually not visible to the user as media. This is like getFilesDir (), because these files will be deleted if the application is deleted [...]

Source: http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir (java.lang.String)

So basically you get a private (sorta) folder on the SD card.

Use this in conjunction with Blackbelt's answer for better effects.

0
source

Source: https://habr.com/ru/post/1397027/


All Articles