2

I am building a music player in android and downloading mp3 files user has purchased from our store(server).

How can I protect those downloaded music files from being shared, copied from SD card and appear in other music player installed on device. I don’t won’t to encrypt the files as it will take bit processing time.

Many Thanks in advance.

user465125
  • 109
  • 2
  • 9
  • That sounds basucally impossible. you could try encrypting them using a key unique to the client or their device, and then decrypting them in memory before playback. – Jasen Dec 25 '14 at 07:54
  • look at this: http://stackoverflow.com/questions/22248471/how-to-protect-the-mp3-file-from-read-or-copy-on-android . and this: http://stackoverflow.com/questions/13106338/android-protect-mp3-file-form-being-shared-but-still-playable – Miki Franko Dec 25 '14 at 07:57

1 Answers1

1

One of the options you have is to save your files in the internal storage like so:

// openFileOuput is the public method defined in the Context class
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();

By passing Context.MODE_PRIVATE as the second argument, you're making this file private, so it can be accessed by this app only (or application with the same user ID). I see two issues, though. The first one is that internal storage is usually limited and can't be extended as external storage. The second issue is that AFAIK user still can access private app data on rooted device.

aga
  • 27,954
  • 13
  • 86
  • 121