So just to clarify (as I have no access to the other app and what it
calls, in this case the other app is the OS-standard 'share/send'
functionality), I override the openFile() method in my app's content
provider, and then when I trigger the 'share' functionality and pass
it in the Uri to the file, the share functionality will then make a
call to openFileDescriptor() which will call my overridden
openFile()... correct?

Anything special I need to do to trigger this workflow, other than the
standard:

Intent share = new Intent(Intent.ACTION_SEND);
share.setType(getString(R.string.note_default_mime_png));
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(shareFileCopy));
startActivityForResult(Intent.createChooser(share, "Share"),
ACTIVITY_SHARE);

Thanks,

Paul

On Apr 23, 12:47 pm, Dianne Hackborn <[email protected]> wrote:
> No shell commands are part of the SDK.  Using shell commands is likely to
> result in your app breaking randomly across devices and platform versions.
>
> The recommended way to do this is to write a content provider, which the
> other app can call ContentResolver.openFileDescriptor() etc.  It is actually
> really easy to write such a content provider -- it doesn't need a database
> or anything, just to implement ContentProvider.openFile().
>
> Every situation I have seen where MODE_WORLD_* is used it causes more
> troubles than just writing a content provider.  I regret having made that.
>
>
>
> On Sat, Apr 23, 2011 at 8:43 AM, Paul <[email protected]> wrote:
> > I have a question over at StackOverflow that's been sitting there for
> > over a month, and wondered if maybe someone here (or a Googlite) could
> > answer it.
>
> >http://stackoverflow.com/questions/5149739/android-problem-setting-fi...
>
> > I have an app where I store .png images in the app's cache directory,
> > and as I am sharing these files via messaging, etc, I need to make the
> > files readable temporarily by everyone (i.e. chmod 755).
>
> > As suggested in another thread, I am running Runtime.getRuntime.exec()
> > to do this:
>
> > Runtime.getRuntime().exec("setperm chmod 755 /path/to/filename.png");
>
> > This works fine, and as I am filtering / and \, any name works...
> > except a name with a space, unsurpisingly. This fails:
>
> > Runtime.getRuntime().exec("setperm chmod 755 /path/to/file name.png");
>
> > So, coming from linux, I try wrapping the file path in quotes, which
> > works on linux, but still fails to change the file perms on Android:
>
> > Runtime.getRuntime().exec("setperm chmod 755 \"/path/to/file name.png
> > \"");
> > or
> > Runtime.getRuntime().exec("setperm chmod 755 '/path/to/file
> > name.png'");
>
> > Any ideas?
>
> > Thanks,
>
> > Paul
>
> > --
> > 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
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

-- 
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

Reply via email to