title: How to find Gmail account associated with Android Market?
body: <p>I know how to find accounts (which will include gmail email ids of user) and how to filter gmail account. </p>
  
  <pre><code>AccountManager am = AccountManager.get(context);
          Account[] accounts = am.getAccounts();
          ArrayList&lt;String&gt; googleAccounts = new ArrayList&lt;String&gt;();
          for (Account ac : accounts) {
              String acname = ac.name;
              String actype = ac.type;
              //add only google accounts
              if(ac.type.equals("com.google")) {
                  googleAccounts.add(ac.name);
              }
              Log.d(TAG, "accountInfo: " + acname + ":" + actype);
          }
          return googleAccounts;
  </code></pre>
  
  <p>What I wish to know is how to find the gmail account associated with Android Market? If you will try to delete a gmail account from Android phone you will get this message
  <img src="https://i.stack.imgur.com/BAyAS.png" alt="enter image description here"></p>
  
  <p>but if you try to delete a gmail account associated with Android Market you will get the following message (if you press <strong>remove account</strong> in the earlier message).</p>
  
  <p><img src="https://i.stack.imgur.com/whe4h.png" alt="enter image description here"></p>
  
  <p>Thanks for the help.</p>