[mono-android] Deleting files on external storage?

Jon Valvatne jon at norsync.com
Tue Mar 29 04:59:54 EDT 2011


Please elaborate. I obviously have WRITE_EXTERNAL_STORAGE set, otherwise the
Create would have failed. I couldn't find a DELETE_EXTERNAL_STORAGE ;)

On Tue, Mar 29, 2011 at 10:57 AM, Morten Nilsen <mortenn at hapro.no> wrote:

>  Hello,
>
> I expect you might find
> http://developer.android.com/reference/android/Manifest.permission.htmluseful in this instance..
>
>
>
>   -- Cheers, Morten
>
>
>
> *From:* monodroid-bounces at lists.ximian.com [mailto:
> monodroid-bounces at lists.ximian.com] *On Behalf Of *Jon Valvatne
> *Sent:* Tuesday, March 29, 2011 10:52 AM
> *To:* Monodroid at lists.ximian.com
> *Subject:* [mono-android] Deleting files on external storage?
>
>
>
> I seem to be unable to create an app that deletes files off the SD card -
> even files created by that same app. A simple test case is a default
> MonoAndroidApplication with these two lines inserted in Activity1.onCreate:
>
>
>
>                 System.IO.File.Create("/sdcard/test.txt");
>
>                 System.IO.File.Delete("/sdcard/test.txt");
>
>
>
> The Create works fine, but the Delete fails with a
> System.UnauthorizedAccessException: Access to the path "/sdcard/test.txt" is
> denied.
>
>
>
> I've tried figuring out if it may be a permissions problem, but it's a bit
> tricky without knowing how the Android platform maps apps to users to
> groups, since the default permission for all files and directories (at least
> as viewed in the adb shell) seems to be 075. But either way, it seems
> impossible that a permission problem should cause me to be able to create a
> file but not delete it, since both operations should require the same
> permission (that is, write permission to the containing directory).
>
>
>
> Has anyone successfully deleted a file off external storage from C# code?
>
>
>
> Thanks in advance,
>
>
>
> Jon Valvatne
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110329/c63a8d4b/attachment.html 


More information about the Monodroid mailing list