Search code examples
androidaccountmanager

list google apps accounts


How can I determine if a specific google account is a Google Apps account?

I have 2 accounts on my phone.

a normal Google acc and a Google Apps account

accountManager = AccountManager.get(getApplicationContext());
Account[] accounts = accountManager.getAccounts();
for ( int i = 0; i < accounts.length; i++ )
{
    Log.d(TAG, accounts[i].name + " - " + accounts[i].type);            
}

It prints "com.google" as type for both.


Solution

  • AFAIK account.name contains email, right?

    Google account (aka gmail) email address contains @gmail.com or @googlemail.com. Google Apps account always have custom domains. This way you can distinguish them.