Monday, April 25, 2011

Android: Getting google account associated wid device

http://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address


Account[] accounts = AccountManager.get(this).getAccounts();
for (Account account : accounts) {
  // TODO: Check possibleEmail against an email regex or treat
  // account.name as an email address only for certain account.type values.
  String possibleEmail = account.name;
  ...
}

No comments:

Post a Comment