1

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?

2 Answers2

1

Is internal storage that you mention mean private location inside your app? As far as I know even you put in internal storage, Media player still able to locate the file unless it is inside your app private location.

What you can do is encrypt the file and store in external storage. When you need to play back, decrypt the file to your app private location and playback.

Joey Chong
  • 1,470
  • 15
  • 20
  • hi @Joey Chong. If I do that, will the user be able to play it in his / her pc when they mount their device? one more question too, will he be able to open the file from file explorer? – Programming Pirate Oct 30 '14 at 07:48
  • No, they will not, unless you have a custom player on the pc which understands the encryption. – Chris Stratton Oct 30 '14 at 08:08
  • You are welcome. Just addon to @Yazan answer, you also can make a small application by embedded media player inside that perform decryption and play at desktop if you want. However, just remember that android have extra provider and algorithms compare to standard java. Also be careful on SecureRandom which the value is different on different platform. – Joey Chong Oct 31 '14 at 02:26
1

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

Yazan
  • 6,074
  • 1
  • 19
  • 33
  • Hi @Yazan thanks for the reply. Even I feel pretty much the same. Looks like that is the only solution. Now I need to do encryption and decryption of audio files and post its pros and cons here... ;) – Programming Pirate Oct 30 '14 at 08:30
  • if i where you, i will start working on Encrypting/Decrypting of records, and once you have a problem (hope you don't) then you make some search about the error, if you find no sol. which i doubt , then make a new question, with the related code and logs .. etc, so you can get better results, good luck. – Yazan Oct 30 '14 at 08:33
  • Thank you Yazan, I did the same thing you explained,now I feel my data is safe, I followed a simple tutorial for the time being, can you suggest me a link regarding encryption and decryption so that I can get a much clearer Idea of available algorithms and their level of security ect.... – Programming Pirate Oct 30 '14 at 12:11
  • i don't have a link or ref in mind now, but some search will help you, searching for encrypt files android java, one of results, shows http://stackoverflow.com/questions/4275311/how-to-encrypt-and-decrypt-file-in-android – Yazan Oct 30 '14 at 12:50