Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent users to view/delete file in sdcard

Tags:

android

I have an internal app that can be distributed to company's users.

The admin can put a file to the device in specified folder in sdcard but don't want the users can view/delete it. What is the best way/concept to achieve it? Have tried researching it but still don't find good solution.

like image 964
Rendy Avatar asked Jan 26 '26 13:01

Rendy


2 Answers

I'm not sure it's even possible. The user can always take the SD card out, put it into a card reader and view/delete it that way. If your app relies on preventing access to a file on SD, then I'd say your design is flawed.

According to the android documentation, you should store private data in the internal storage and store public data in the external storage - have a look at the storage options documentation for more info.

If you require to store/read files that users shouldn't be able to access other than through you app, then you should store these files in the local directory for the app (which would normally be under /data/data/your.app.package). Use openFileInput and openFileOutput methods on a Context to read/write such files.

like image 150
Aleks G Avatar answered Jan 29 '26 02:01

Aleks G


If your application uses some files then put these file into application's assets folder. If file present in sdcard then any one can view and delete.

like image 45
Brajendra Pandey Avatar answered Jan 29 '26 02:01

Brajendra Pandey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!