My app wants to send a data file by email.

However, the data only exists inside the database. There is no physical
file containing it.

In order to make it possible to send this using INTENT_SEND, I need to
return a file descriptor in ContentProvider.openFile(). This means I
need to write my data out to a temporary file on disk somewhere so I can
open it to get a real file descriptor.

However, the email app doesn't necessarily use the file immediately, and
*doesn't tell me* when it's finished with it, so I don't know when to
remove the temporary file. As the file is likely to be quite large I
don't want to keep it around for long periods.

What I'd really like to do is to be able to avoid the whole issue by
using a callback to synthesise the data as and when the email app needs
it, using some sort of pipe. Unfortunately due to the real file
descriptor requirement I can't use Java pipes, there are no Unix fifo
APIs that I can find, and you can't create a ParcelFileDescriptor from a
Unix socket, which was my other option.

Is there any easy way to do what I want, or do I need to start messing
around with TCP sockets?

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ }
│ --- Conway's Game Of Life, in one line of APL

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to