Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the android username stored in the phone

Tags:

android

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.

like image 866
Jon Avatar asked Jul 29 '10 19:07

Jon


People also ask

Where are my usernames and passwords stored on Android?

Select “Settings” near the bottom of the pop-up menu. Locate and tap on “Passwords” partway down the list. Within the password menu, you can scroll through all of your saved passwords.

How do I find saved usernames?

Click the "Manage Saved Passwords" link. Chrome will display all of the saved usernames associated with saved passwords; however, Chrome will not display any usernames saved without a password. To view those usernames, you will need to check each individual website.

Can I see my saved passwords on my phone?

Your passwords can be stored on an Android phone or tablet using your Google Chrome app. The passwords stored in the Google Chrome app are linked to your Google account, so you can access them through Google Chrome on a Mac or PC as well.


1 Answers

Username is available to you; just use:

String email = accounts[0].name;

like image 170
nikib3ro Avatar answered Oct 21 '22 04:10

nikib3ro