检索配置在Android的Gmail帐户详细资料 [英] retrieve gmail account details configured in android

查看:156
本文介绍了检索配置在Android的Gmail帐户详细资料的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我要发送邮件点击一个按钮时。我把所有的信息发送邮件,除了从地址。这种从地址应该是配置在Android手机上的Gmail帐户。我怎样才能获取这些信息?任何人都可以请帮助?

In my application, I have to send a mail when a button is clicked. I have all details for sending the mail except the "from address". This "from address" should be the gmail account configured in the android phone. How can I fetch those details? Can anyone please help?

推荐答案

它得到通过的AccountManager类的工作。

It got worked by using AccountManager class.

AccountManager manager = AccountManager.get(this);
Account[] accounts = manager.getAccountsByType("com.google");
Account account = accounts[0];

我们可以通过获取帐户名

We can fetch account name using

account.name

和使用加密的密码

manager.getPassword(account)

这篇关于检索配置在Android的Gmail帐户详细资料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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