Mostafa Imran
Mostafa Imran

Reputation: 668

Save file in android, so the user can't read

I am developing an app in android where it download image files and use it as app resource. I want to save the file in a directory so that user can't see this as media files shown in gallery. I just need to know the specific directory where i can save the file and the user wouldn't able to see it.

Upvotes: 4

Views: 2098

Answers (5)

Diego Torres Milano
Diego Torres Milano

Reputation: 69426

Just add a file named .nomedia in the directory you want to exclude from MediaScanner.

Upvotes: 1

Zala Janaksinh
Zala Janaksinh

Reputation: 2927

Just Simple apply your own logic. when u read the file from internet is byte format. and after right in to sdcard.

this time just change the some byte of read file.and store this byte in some place like a sharepreference,Static varibale anything.and when you read file and display else play then change the same byte agian and replace this byte with orignal.this call incrypt and decrept. it`s work dear i do for image file.

Upvotes: 1

vnshetty
vnshetty

Reputation: 20132

Using the Internal Storage You can save files directly on the device's internal storage. By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user). When the user uninstalls your application, these files are removed.

Upvotes: 1

TieDad
TieDad

Reputation: 9939

Android would automatically scan all folders on external storage for media files. If you don't want your image files to show in the gallery, maybe you could add some extension like ".myapp", this way cheats the scanner.

Upvotes: 3

Lazy Ninja
Lazy Ninja

Reputation: 22537

Another alternative is to save your image in a Database as a BLOB.
With this you are 100% sure that only your application can access it.

Upvotes: 0

Related Questions