4

We generate a temporary file on an Android device and attach it to an email. We use a custom Content Provider to feed that file to the email application. The problem is that the email application access the file many times, instead of once, until it finally sends the email (for example, every time it writes a draft we get a request).

That makes hard to know when to delete that temporary file.

Any ideas on a safe method to know when our email was delivered so we can clean the device and not leave trash behind? (periodically delete also does not seem right as the phone can be for a while with the email in the Drafts folder)

Thanks a lot for the help!

4

1 回答 1

1

是的,是的,我知道这是一岁。但是我们遇到了同样的事情。

我们所做的是使用 ContentProvider.openFile() 按需合成数据并将其直接流式传输到电子邮件应用程序,而不是将其写入临时文件。为此,您需要从 ContentProvider 的 query() 方法返回符合 OpenableColumns 的行;然后电子邮件应用程序将返回 openFile() 并且您返回 ParcelFileDescriptor。

不幸的是,这有点黑魔法,我们发现许多应用程序都弄错了——DropBox有点问题,现在(我注意到你的问题的原因)我们正在与三星专有的蓝牙前端作斗争结尾。我不知道为什么供应商不能把事情不管不顾...

于 2011-06-13T13:38:52.643 回答