如何从Android应用程序发送/打开电子邮件附件? [英] How to send/open email attachments from android app?

查看:124
本文介绍了如何从Android应用程序发送/打开电子邮件附件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以某种方式将一个Android设备上的应用程序的文件发送到另一个设备上的应用程序。这可以以任何方式完成,如果您能告诉我如何通过网络发送或类似的东西,我可以接受建议。

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.

目前,我正在将文件发送为电子邮件附件,但是我没有找到任何有关如何做的文档。我需要两件事情才能完成,可以将我的文件(存储在SD卡或设备上的某个位置)作为附件,并将我的应用程序识别为android作为应用程序打开附件与文件扩展名(.lst)

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

任何想法?

如果这些文件有所作为,这些文件都将是相当小的xml文本文件。

The files will all be fairly small xml text files if that makes a difference.

推荐答案


我想以某种方式从一个android上的应用发送一个文件
设备到
我的应用程序在另一个设备上。这可以是
完成任何方式,如果你能告诉我如何
通过网络或像
这样的东西,我开放
的建议。

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.

编写一个Web服务。或使用Amazon SQS。

Write a Web service. Or use Amazon SQS.


可以将我的文件(存储在sd
卡或设备上的某个位置)作为
附件

be able to send my file (stored on sd card or somewhere on device) as an attachment

正如撰写这里,你可以尝试:

As is written up here, you could try:

Intent sendIntent = new Intent(Intent.ACTION_SEND);

sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
sendIntent.putExtra(Intent.EXTRA_STREAM, ...);
sendIntent.setType(...); 

其中第一个省略号是您选择的文件的路径,第二个省略号是合适的MIME类型。

where the first ellipsis is the path to your chosen file and the second ellipsis is a suitable MIME type.


,并将我的应用程序确定为android
作为应用程序打开附件,
文件扩展名(。 lst)

and have my app recognized by android as the app to open an attachment with the file extention (.lst)

不要依赖文件扩展名。使用MIME类型。您可以使用意图过滤器设置活动,为您的MIME类型提供 ACTION_VIEW 支持。

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.

这篇关于如何从Android应用程序发送/打开电子邮件附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆