如何获得存储在设备的用户自己的电子邮件地址? [英] How to get user own email addresses stored in the device?

查看:225
本文介绍了如何获得存储在设备的用户自己的电子邮件地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检索的用户的所有电子邮件地址,存储在设备(未他的朋友的电子邮件地址,但是他自己的电子邮件地址)。
举例来说,如果我有3电子邮件地址geltrude@gmail.com,geltry@yahoo.co.uk和cippalippa@hotmail.com,我在找一个返回这三个字符串数组(或类似)的方法: [geltrude@gmail.com,geltry@yahoo.co.uk,cippalippa@hotmail.com]。
任何想法?

I need to retrieve all the email addresses of the user, stored in the device (not the email addresses of his friends, but his OWN email addresses). For example, if I've three mail addresses geltrude@gmail.com, geltry@yahoo.co.uk and cippalippa@hotmail.com, i'm looking for a method that returns an array (or similar) with these three Strings: ["geltrude@gmail.com", "geltry@yahoo.co.uk", "cippalippa@hotmail.com"]. Any idea?

编辑:我想获得存储在设备上的我联络的电子邮件地址,以及存储在默认的邮件应用程序,并在Gmail客户端应用程序在自己的电子邮件地址(即是默认使用的应用程序,我认为)。
提前致谢。
-G。

I'd like to get the email addresses stored in the "me" contact on the device, plus the own email addresses stored in the default mail app and in the gmail client app (that are the default used apps, I think). Thanks in advance. G.

推荐答案

大多数这些地址是由电子邮件客户端保持不具有内容提供商得到他们。

Most of those addresses are maintained by email clients which don't have content providers to get at them.

如果你的目标是使用地址列表选择的返回地址外发电子邮件,不适合做事情的方式的Andr​​oid。您的应用程序应该宣布,它希望通过抛出适当,配备 ACTION_SEND 意图发送电子邮件。无论最终的应用服务可能给用户一个选择哪些帐户,并返回地址发送它用。

If your goal is to use the address list to select the return address for an outgoing email, that doesn't fit the Android way of doing things. Your application should announce that it wants to send an email by throwing out a properly-outfitted ACTION_SEND intent. Whatever application ultimately services it may give the user a choice about which account and return address to use in sending it.

附录:

默认的电子邮件客户端有一个叫做内容提供商内容://com.android.email.provider/account ,你不应该或不能使用,因为:

The default email client has a content provider called content://com.android.email.provider/account that you shouldn't or can't use because:


  • 它是无证。

  • 其清单要求的应用程序想要使用它有 com.android.email.permission.ACCESS_PROVIDER 的权限。

  • 这允许有一个的ProtectionLevel signatureOrSystem ,这限制了授予存储在系统中的图像或签名的软件相同的键的那些系统中的图像。您的应用程序不太可能陷入其中任何一个类别。

  • It's undocumented.
  • Its manifest requires that apps wanting to use it have the com.android.email.permission.ACCESS_PROVIDER permission.
  • That permission has a protectionLevel of signatureOrSystem, which restricts grants to apps stored in the system image or signed with the same key as those in the system image. Your application is unlikely to fall into either of those categories.

其他的事情需要注意的:

Other things to be aware of:


  • 谁也不能保证一个给定的设备将有电子邮件支持。

  • 在设备上的电子邮件可以由第三方电子邮件客户端(例如,K9,七,达阵,MailDroid或其他)维护自己的帐户数据库并有可能不公开它提供服务。

这篇关于如何获得存储在设备的用户自己的电子邮件地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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