检索android中配置的gmail帐户详细信息

检索android中配置的gmail帐户详细信息,android,Android,在我的应用程序中,我必须在单击按钮时发送邮件。除了“发件人地址”之外,我有发送邮件的所有详细信息。这个“发件人地址”应该是安卓手机上配置的gmail帐号。我如何获取这些详细信息?有人能帮忙吗?您可以使用内置的操作发送想要使用默认的android邮件发送应用程序,您有一个例子 这是您需要的部分: final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); //set the content-type emai

在我的应用程序中,我必须在单击按钮时发送邮件。除了“发件人地址”之外,我有发送邮件的所有详细信息。这个“发件人地址”应该是安卓手机上配置的gmail帐号。我如何获取这些详细信息?有人能帮忙吗?

您可以使用内置的
操作发送
想要使用默认的android邮件发送应用程序,您有一个例子

这是您需要的部分:

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
//set the content-type
emailIntent.setType("plain/text");
//set the receivers address
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { address.getText().toString() });
//set the subject
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText());
//set the text
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText());
Email.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

注意:我还没有亲自测试它

它是通过使用AccountManager类工作的

AccountManager manager = AccountManager.get(this);
Account[] accounts = manager.getAccountsByType("com.google");
Account account = accounts[0];
我们可以使用

account.name
以及使用

manager.getPassword(account)

我必须在后台发送邮件。如果我真的喜欢这样,就会弹出一个屏幕询问细节……有人知道吗?有人用过谷歌登录服务助手吗???到目前为止,这不起作用。我得到以下错误:“java.lang.SecurityException:调用方uid 10155与验证器的uid不同”。我认为你无法从第三方应用程序中获得谷歌密码。如果我错了,请纠正我,并发布此问题的解决方案。谢谢