Prevent media scanning, set resolution or lock folder and file in android

In my application, I upload another image and save it inside the sdcard under a folder. This file will be used later in my application.
What I need is to make this folder visible only to my application. I mean that images should not be available in the gallery of Android and others.
I also save the sqllite file inside this folder. I also want to restrict any other access to this sqllite file.
Do I need to generally allow permission for the folder and file so that it is available only for my application? Is there a way to lock a folder or file for a specific application?
Thanks in advance.

+3
source share
3 answers

Finlay, I found the answer to this question. I did this without setting permission, but we can hide the files from Media Scanner.
Include an empty file with a name .nomediain the external file directory (pay attention to the point prefix in the file name). This will prevent you from reading Android media files and including them in applications such as Gallery or Music.

+4
source

you can take a look at the Environment class on the dev site Also look at a sample of the external DEMO API storage to learn how to handle confidential / public SD access

0
source

In froyo, you have secure storage management (called secure containers), but I don’t know exactly how it works and whether it is accessible directly. Another solution is to encrypt your entire file from your application. I don’t think that there is an easy way to set “unix like” permissions, since all applications work with the same permission, and the root user can access anywhere.

0
source

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


All Articles