I want to create a local blob storage system where I can upload files, and they will be stored in a location inaccessible to file pickers and the gallery—only my app should have access to them.
I initially tried using SQLite to store the files, but it didn’t work as expected. Ideally, I need a solution that ensures:
- The files are stored securely on the device.
- They remain hidden from other apps, file explorers, and media pickers.
- Only my app can access and retrieve these files when needed.
What would be the best approach to achieve this? Are there any specific databases, file storage mechanisms, or encryption techniques I should consider?
Any guidance or code examples would be greatly appreciated!
I want to create a local blob storage system where I can upload files, and they will be stored in a location inaccessible to file pickers and the gallery—only my app should have access to them.
I initially tried using SQLite to store the files, but it didn’t work as expected. Ideally, I need a solution that ensures:
- The files are stored securely on the device.
- They remain hidden from other apps, file explorers, and media pickers.
- Only my app can access and retrieve these files when needed.
What would be the best approach to achieve this? Are there any specific databases, file storage mechanisms, or encryption techniques I should consider?
Any guidance or code examples would be greatly appreciated!
Share Improve this question asked Jan 30 at 12:48 Anshuman SharmaAnshuman Sharma 158 bronze badges1 Answer
Reset to default 0Files stored in internal storage (context.getFilesDir()) are only accessible to your app by default. Other apps (including file explorers and media pickers) cannot access them.
File file = new File(context.getFilesDir(), "secure_blob.dat");
FileOutputStream fos = new FileOutputStream(file);
fos.write(fileData);
fos.close();