Search code examples
androidgoogle-checkout

Google Checkout Account Username


I'm looking for a method that returns me the Google Checkout User Account of the owner of the telephone...

I explain: when I buy an application over the market, in the phone is stored somewhere the Google Account that I use to purchase the app (that maybe can be different from the main google main account?). I need a method, if exists, that gives me this account (only the username, I don't need the password!).

Thanx in advance


Solution

  • AccountManager accountManager = AccountManager.get(this);
    
    Account[] accounts = accountManager.getAccountsByType("com.google");
    
    googleCheckoutUser = accounts[0].name.trim();