I am building an app that plays music and video packs that are purchased by the app user. The media needs to be downloaded to the device where it can be accessed offline. The files will be downloaded to the device.
The methods I know of to download the files leaves the ability for the file to be accessed through file manager and MediaStore. The problem with this is that some of the files are only licensed to play in the app.
Is there a way to lock the file or place it in the system media (audio and video) so the user cannot access it outside of the app.
Thanks
As per android official documents you need to store your file in private location
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.
String FILENAME = "hello_file";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();