Skip to content

Instantly share code, notes, and snippets.

@Mrono
Created August 14, 2013 02:30
Show Gist options
  • Save Mrono/6227537 to your computer and use it in GitHub Desktop.
Save Mrono/6227537 to your computer and use it in GitHub Desktop.
List google accounts for android
private String[] getGoogleAccounts() {
ArrayList<String> accountNames = new ArrayList<String>();
Account[] accounts = AccountManager.get(this).getAccounts();
for (Account account : accounts) {
if (account.type.equals("com.google")) {
accountNames.add(account.name);
}
}
String[] result = new String[accountNames.size()];
accountNames.toArray(result);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment