Search code examples
androidsecurityassets

How to secure assets files in Android


I need to store audio files in the application. Access to these files should be restricted. How can I safely store these files?

I tried to store in the assets folder, but when unpacking the apk, these files can be obtained.

Also I used the extension files as a zip archive, however, this file can be assigned and the files can be retrieved by the user.

Is there a way to store files so that the user can not get them?


Solution

  • Is there a way to store files so that the user can not get them?

    Download them and never write them to disk.

    Or, download them and write them to internal storage (e.g., getCacheDir()), noting that users who root their devices could still get at them.

    You are welcome to try encrypting the assets, then decrypting them before use. However, since the decryption algorithm and key will be in the app, people can reverse-engineer the app and learn how to decrypt the assets.