I am writing an application that requires to retrieve the android username [email protected] from the phone. I have been looking at AccountManager class. This is what I have for now in my code.
AccountManager accountManager = AccountManager.get(this);
Account[] accounts =
accountManager.getAccountsByType("com.google");
String email="";
email=accountManager.getUserData(accounts[0], accountManager.KEY_USERDATA);
However, I am getting a caller uid 10085 is different than the authenticator's uid exception. Anyone knows how to do it?
PS. I don't need password or authentication token, I just need the username.