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

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

问题描述

我想以某种方式来自我的应用程序在一个Android设备将文件发送到我的应用程序上的其他设备。这是可以做到任何方式,我很开放的建议,如果你能告诉我如何发送通过网络或类似的东西。

目前,我期待在发送文件作为电子邮件附件,但我还没有找到如何做到这一点任何好的文档。我需要两件事情做到这一点,能送我的文件(存储在SD卡或地方上的设备)作为附件,并认识到安卓我的应用程序的应用程序打开附件的文件扩展(.LST)

有什么想法?

中的文件都将是相当小的XML文本文件,如果有差别。

解决方案
  

我想以某种方式发送文件   从我的应用程序在一个Android设备来   我的另一台设备上的应用程序。这可以是   做任何方式,我开   建议如果你能告诉我如何   发送通过网络或类似的东西   这一点。

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

  

能送我的文件(存储在SD   卡或某处的设备),其为   附件

由于写了href="http://groups.google.com/group/android-developers/browse_thread/thread/65b4ec9ab8c57112" rel="nofollow">此处

 意图sendIntent =新的意图(Intent.ACTION_SEND);

sendIntent.putExtra(Intent.EXTRA_SUBJECT,学科);
sendIntent.putExtra(Intent.EXTRA_STREAM,...);
sendIntent.setType(...);
 

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

  

和已经认识到通过安卓我的应用程序   作为应用程序打开的附件   文件扩展(.LST)

切勿依赖于文件扩展名。使用MIME类型。您可以设置一个活动,意图过滤器,可为您的MIME类型 ACTION_VIEW 支持。

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.

解决方案

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.

Write a Web service. Or use Amazon SQS.

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

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

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

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天全站免登陆