Reputation: 712
Requirement is application will download some mp3 files and that are stored in external storage. We need to restrict those files to be played in any other media player provided by android.
Upvotes: 2
Views: 1305
Reputation: 48871
As I understand it you only want your mp3 files to be played by your own app. Correct?
If that's the case then you have a problem with external storage as it has 'public' access status. Any app can access any file anywhere in external storage.
The closest you can get to restricting media files in external storage is to create a file called .nomedia
in the same directory. This will prevent the media scanner from adding the files to the media content provider so other apps won't see them by default. Anybody using a file manager app, however, will be able to find and play the files with any media player they choose.
If you really want to restrict the files to your own app then you need to save them to internal (private) storage. Even than, a phone which has been rooted will allow access to any app's private storage area so there's still no guarantee they'll be 100% restricted.
Upvotes: 2