On Fri, Oct 29, 2010 at 6:03 PM, John Gaby <[email protected]> wrote:
> If I have a File object which points to a non-existent directory
> (which is within my apps 'app_data' space), I can call file.mkdir() or
> file.mkdirs() to create the directories. However, if I do this, the
> directories seem to be created with permissions set for access only by
> the owner (i.e. drwx------). Then if I write a .mp3 file into that
> directory, I cannot later play that .mp3 file using the MediaPlayer,
> apparently because it does not have permission to read the file (note
> that if I put the .mp3 file directly in the 'app_data' directory, it
> works fine). How can I set the permissions on the directories that I
> create so that the MediaPlayer can access the files?
Literally, I think the only answer is:
Runtime.getRuntime().exec("chmod 755 " + fileName);
If you create files via openFileOutput(), you can specify permission
bits, but that only works for files immediately in the app-local file
store.
Or, put the files on the SD card.
Or, create a content provider that serves up the files to the
MediaPlayer. This is probably the best answer (does not assume
command-line binaries that may or may not exist).
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Android 2.2 Programming Books: http://commonsware.com/books
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en