How to make a file hidden in android sd card?

别说谁变了你拦得住时间么 提交于 2019-11-26 14:48:44

问题


I am creating android application which contains DB that needs to be hidden(not able to access by the user)in the SD Card. Can anyone tell me how to do this?


回答1:


Any file stored on the SD card is accessible both by applications running on the phone, and by users who have mounted the SD card (both while it's in the phone and otherwise).

You can change the file properties to make it 'hidden', but it will still be easily found. There is no way to make a file on a public partition like an SD Card 'secure' in the manner you describe - users will always be able to copy, delete, and potentially change the file.

The best solution to your problem is to look into ways to encrypt your database to record it securely. You won't be able to prevent users from deleting or copying the file, but you should be able to make it difficult for them to read data from it or modify its contents.




回答2:


For an easy solution, just prefix the db file with a . (like .dbfile). This will hide the file on Linux based systems, including android.

I am assuming that you want to hide the file to prevent users from accidentally deleting/changing it.




回答3:


SD cards cannot be secured in the fashion you seek.




回答4:


just name the file start by ."Dot"... ".myFolder/.myfile"




回答5:


You can create a folder whose name starts with a dot(.) example (.dbfiles) android See these folders as configuration folder and do not show content of these folder in applications like gallery,music player...You can see these folders with advance file explorer like Es File explorer




回答6:


Sdcard you cant't! Internal app data partition is the place for you.



来源:https://stackoverflow.com/questions/1129644/how-to-make-a-file-hidden-in-android-sd-card

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!