tags:

views:

2728

answers:

3

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?

+2  A: 

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.

futureelite7
i want the file could not visible to the user because the db file is a secure one (the size of the file is 17 mb+ thats why i create it in sd card).the user did not have permission to copy,delete/change.
arams
To detect changes, add an authentication tag.
tuergeist
A: 

SD cards cannot be secured in the fashion you seek.

CommonsWare
+3  A: 

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.

Reto Meier
if i do encryption,the decrypted file also saved in the sd card.so the application size must be doubled.any idea (db file size 17 mb)
arams
why would the decrypted file also be on the SD card? What's the point of enctrypting it then? After you encrypt, you shoudl delete the un-encrypted version. 17mB is not so big, so there will be no problem holding a temp copy in RAM when en/de=crypting.
Mawg