Android的意向选择器只显示电子邮件选项 [英] Android Intent Chooser to only show E-mail option

查看:143
本文介绍了Android的意向选择器只显示电子邮件选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序集成了电子邮件,用户可以从应用程序直接提交bug报告,反馈等。我使用的应用程序/八位字节流作为的setType的意图。当你去提交电子邮件你得到的内容选择器,它显示了Evernote的,脸谱,电子邮件等。

My app integrates e-mail where the user can submit a bug report, feedback, etc. from the app directly. I'm using the application/octet-stream as the SetType for the Intent. When you go to submit the e-mail you get the content chooser and it shows various items from Evernote, Facebook, E-mail, etc.

我如何能得到这个选择器只显示邮件,以免给用户的所有适合的内容选择器类型这些物品混为一谈?

How can I get this chooser to only show E-mail so as not to confuse the user with all these other items that fit the content chooser type?

感谢你。

推荐答案

我是你使用的是 ACTION_SEND 意图presuming 操作,因为你没有打扰你正在使用的实际状态,但你同意@ Aleadam的评论。

I am presuming that you are using the ACTION_SEND Intent action, since you did not bother to actually state what you're using, but you agreed with @Aleadam's comment.

我使用的应用程序/八位字节流作为的setType的意图。

I'm using the application/octet-stream as the SetType for the Intent.

在那句话没有什么事情的电子邮件限制了。

Nothing in that sentence limits things to email.

ACTION_SEND 是一个普通的,可以由想要的任何应用程序支持的意图的行动。你要做的就是指明哪些数据您共享和MIME类型的数据 - 从那里,它是由从现有活动用户选择

ACTION_SEND is a generic Intent action that can be supported by any application that wants to. All you do is indicate what data you are sharing and the MIME type of that data -- from there, it is up to the user to choose from available activities.

由于@Jasoon表示,你可以尝试消息/ RFC822 的MIME类型。然而,这并不表示不是只提供电子邮件客户端 - 它表明提供了支持消息/ RFC822 数据什么。这可以很容易地包括一些应用程序,没有电子邮件客户端。

As @Jasoon indicates, you can try message/rfc822 as the MIME type. However, that is not indicating "only offer email clients" -- it indicates "offer anything that supports message/rfc822 data". That could readily include some application that are not email clients.

如果你特别希望通过电子邮件发送的东西,JavaMail的集成到您的应用程序或Web服务器上写电子邮件转发脚本,并调用它,什么的。如果你使用 ACTION_SEND ,你含蓄说,它是用户想要的事情,并且希望用户能够通过发送这样的,某某的数据无论装置用户选择

If you specifically want to send something by email, integrate JavaMail into your app, or write an email forwarding script on your Web server and invoke it, or something. If you use ACTION_SEND, you are implicitly stating that it is what the user wants that matters, and you want the user to be able to send such-and-so data by whatever means the user chooses.

这篇关于Android的意向选择器只显示电子邮件选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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