开发者

prevent media scan, set permission or lock the folder and file in android

开发者 https://www.devze.com 2023-01-26 17:41 出处:网络
In my app, me downloading different image and saving inside sdcard under a folder. That file is later used in my app.

In my app, me downloading different image and saving inside sdcard under a folder. That file is later used in my app.

What i need is, make this folder only visible to my app. I mean the images shou开发者_开发问答ld not be available in Android Gallery and other.

Me also saving the sqllite file inside this folder. I also want to restrict any other access to this sqllite file.

Is there anyway to set permission like anything for folder and file, so that it can only available to my app? Is there anyway to lock a folder or a file to some specific app?

Thanks in advance.


Finlay i found the answer for this
I done it without setting permission, but we can Hide out files from the Media Scanner
Include an empty file named .nomedia in your external files directory (note the dot prefix in the filename). This will prevent Android's media scanner from reading your media files and including them in apps like Gallery or Music.


you might want to take a look at the Environment class on the dev site Also look at the API DEMO External storage sample to see how to handle access privately/publicly to the SD


In froyo, you have some secure storage management (called secure containers) but i don't know exactly how it work and if it's directly accessible. An other solution is to encrypt all your file from your application. I don't think there is an easy way to set "unix like" permissions, since all app run with the same permission and a rooted user can access anywhere.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号