On Mar 6, 2012, at 11:35 AM, Wally McClure wrote:
> I'm digging into the shared action provider demo from mike.  When I attempt 
> to run it on my ics emulator session, I am getting  an error on the line 
> where it creates the new FileStream object:
>  
> string filePath = Path.Combine (new string[]{"data", "data", PackageName, 
> "files", fileName});

Please, please, PLEASE, never do this. Nothing requires that apps be located in 
/data/data/PackageName (afaik), and if the vendor ever decides to move things 
you're going to suffer a horrible flaming death.

Either use Context.FilesDir.AbsolutePath, or use 
System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); 
they return the same value.

> I am assuming that this is a permission issue.  Specifically, it is a 
> System.UnauthorizedAccessException.  It is trying to access the filepath:
> data/data/ShareActionProviderDemo.ShareActionProviderDemo/files/monkey.png
>  
> Any thoughts on how to resolve the issue properly?

For sanity:

        adb shell ls -l 
/data/data/ShareActionProviderDemo.ShareActionProviderDemo/

What are the permissions for the `files` directory, and what is the owner & 
group owner?

Also, which version of Mono for Android is this? 4.0.3 (iirc) had a bug when 
deploying to the emulator wherein the `files` directory would be owned by root, 
not the app, thus preventing the app from reading or writing anything to the 
files directory. This should have been fixed in 4.0.4.

Thanks,
 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to