我在其他问题上看过如何获取设备电子邮件,但我需要收到当前用户的电子邮件
我正在实施应用内结算并需要知道用户的电子邮件是什么用于安全检查,因此我必须获得的电子邮件必须与目前用于其GooglePlay帐户的电子邮件相同,并且此方法不会&# 39;听起来非常可靠
Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+
Account[] accounts = AccountManager.get(context).getAccounts();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
String possibleEmail = account.name;
...
}
}
智能手机可以保存更多帐户,但我不知道如何知道列表中各个帐户之间当前帐户的活动情况。