如何从 Android 应用程序发送/打开电子邮件附件?
我想以某种方式将文件从一台 Android 设备上的应用程序发送到另一台设备上的应用程序。这可以通过任何方式完成,如果您能告诉我如何通过网络发送或类似的东西,我愿意接受建议。
目前,我正在考虑将文件作为电子邮件附件发送,但我还没有找到任何关于如何执行此操作的良好文档。我需要两件事来完成此任务,能够将我的文件(存储在 SD 卡或设备上的某个位置)作为附件发送,并让 Android 将我的应用程序识别为打开带有文件扩展名 (.lst) 的附件的应用程序。
有什么想法吗?
如果有区别的话,这些文件都将是相当小的 xml 文本文件。
I would like to somehow send a file from my app on one android device to my app on another device. This can be done any which way, and I'm open to suggestions if you can tell me how to send over network or something like that.
Currently, I'm looking at sending the file as an email attachment, but I haven't found any good documentation on how to do it. I need two things to accomplish this, be able to send my file (stored on sd card or somewhere on device) as an attachment, and have my app recognized by android as the app to open an attachment with the file extention (.lst).
Any thoughts?
The files will all be fairly small xml text files if that makes a difference.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编写一个 Web 服务。或者使用 Amazon SQS。
此处所写,您可以尝试
:第一个省略号是您选择的文件的路径,第二个省略号是合适的 MIME 类型。
切勿依赖文件扩展名。使用 MIME 类型。您可以使用 Intent 过滤器设置 Activity,为您的 MIME 类型提供
ACTION_VIEW
支持。Write a Web service. Or use Amazon SQS.
As is written up here, you could try:
where the first ellipsis is the path to your chosen file and the second ellipsis is a suitable MIME type.
Never rely on file extensions. Use MIME types. You can set up an activity with an intent filter that offers
ACTION_VIEW
support for your MIME type.我这样做是为了处理附加到邮件的 vcf 文件,它有效。以下是意图文件管理器:
请参阅 http://code.google.com/p 中的完整代码/卡片捕手。
I did this in order to process vcf files attached to mails and it worked. Here is the intent filer:
See the whole code in http://code.google.com/p/card-catcher.