获取设备的电子邮件ID是配置了Play商店中 [英] Get Email Id of device which is configured with PlayStore
本文介绍了获取设备的电子邮件ID是配置了Play商店中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能获得被配置在Android设备Play商店中应用程序的电子邮件ID / IDS。
Is it possible to get email id/ ids which are configured with PlayStore app in android device.
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
Account[] accounts = AccountManager.get(getActivity()).getAccounts();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
primaryEmailID = account.name;
}
}
通过使用这种code我得到的电子邮件ID的所有套装置即,Gmail,雅虎等配置
但我怎么能得到的只有Gmail帐户的电子邮件ID(我猜的Gmail帐户的电子邮件ID被Play商店中配置)。
By using this code I get all sets of email ids configured in device i.e, gmail, yahoo, etc. But how can I get email ids of only gmail account(I guess email ids in gmail account gets configured in playstore).
推荐答案
如果你只想访问谷歌帐户使用尝试:
If you want to access just to Google accounts try using:
AccountManager.get(getActivity()).getAccountsByType("com.google")
这篇关于获取设备的电子邮件ID是配置了Play商店中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文