I want to get the email id from android device. i saw AccountManager will help. but it is from api level 8. my application needs to support for all API levels. so can please share any document to get the email id.
Asked
Active
Viewed 550 times
1 Answers
0
// API level 5+
Pattern email = Patterns.EMAIL_ADDRESS;
Account[] accounts = AccountManager.get(context).getAccounts();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
String possibleEmail = account.name;
}
}
API level 14+
Use ContactsContract.Profile
Detailed answer by Roman Nurik