After Digging around, I finally ended up downloading every related app (outlook, linkedin, twitter..) and dumping there account types using the following code:
public void pickUserAccount() {
/*This will list all available accounts on device without any filtering*/
Intent intent = AccountPicker.newChooseAccountIntent(null, null,
null, false, null, null, null, null);
startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
}
/*After manually selecting every app related account, I got its Account type using the code below*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_PICK_ACCOUNT) {
// Receiving a result from the AccountPicker
if (resultCode == RESULT_OK) {
System.out.println(data.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE));
System.out.println(data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME));
} else if (resultCode == RESULT_CANCELED) {
Toast.makeText(this, R.string.pick_account, Toast.LENGTH_LONG).show();
}
}
}
And this is the following results that I got:
- Outlook (Hotmail, Live):
com.outlook.Z7.eas
- LinkedIn:
com.linkedin.android
- Facebook:
com.facebook.auth.login
- Twitter:
com.twitter.android.auth.login
- Every other Imap email accounts used
in Android Mail app:
com.google.android.legacyimap
(Thanks to
Ozbek)
- and of course Google:
com.google
I am still missing the yahoo account type, cause the yahoo mail app kept crashing on my device.
Therefore I hope that if you have yahoo's account type, please share it.
REVISION 7-12-2015 with a Better Solution
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
Account[] accounts = AccountManager.get(getActivity()).getAccounts();
ArrayList<String> emails = new ArrayList<String>();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
emails.add(account.name);
}
}
AccountPicker.newChooseAccountIntent()
class/method. – Stockmon