Search code examples
android-mediaplayerandroid-fileandroidandroid-audiorecord

Android make my app files only play from inside the app


I created an app in which the client can record few conversations and store in external storage. The client must be able to transfer the files if needed. So I am storing the recorded files in external storage. But client don't want the files to be played from outside the app, (from sd card) or from music player. Is it possible? Please let me know. Is using internal storage is the only way to do it?


Solution

  • well this is not a programming question, but ...

    you have 2 options here, decide based on your requirements

    1) if you want the records to be simply not appear in any player or multi media app, you have 2 options: A- let the storing folder name starts with . (ex, .myrecords) OR B- add a file inside the folder named .nomedia

    but this will not PROTECT the records, as if someone mounts the sd-card records can be copied and played on any device/pc

    2) if you want to secure the files, you will need to encrypt them as advised by Joey Chong so once the recording completed, the file got encrypted, and stored on external storage once the user enters the playback screen, and picks a file to play, the app will decrypt it first, in a new (temp file) then play it, and delete the temp file once user leaves the playback screen.

    -- for exporting the records to PC or other devices, you can add a function (button maybe) to export selected records, that simply decrypts the selected files into a specific folder, say (/appfolder/exported/) then user can copy them or do whatever... and user have to DELETE the files at export folder once purpose of export is ended. (maybe a button too) Clear Exported

    storing in internal is not good idea, specially audio/video as it might be large files, and some devices does not have really large internal storage.

    this could be more a comment but its way too long