title: How can I get Primary Email Account of Android phone?
body: <p>I am working on a project, and I have to fill the EditText automatically with the user's primary email, I am considering primary email as the email that associated with google play store. I have read <a href="https://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address">this</a> post and implemented that.</p>
  <p>If we are using the AccountManager class for geting the email ids, we will get all the email id added in that phone, so that is not possible, and some says to take the first email id that returned by the AccountManager, but that returns the email id that added in the phone for the first time.</p>
  <p>ie,
  suppose I have added test@gmail.com and linked that with Google Play, later I have added test_new@gmail.com and associated this account with play store, right now I am using Play store with this account. If I have wrote code as follows:</p>
  <pre><code>    Account[] accountList = AccountManager.get(this).getAccountsByType(&quot;com.google&quot;);
  Log.d(&quot;Play store account:&quot; , accountList[0].name);
  </code></pre>
  <p>the expected out put for the statement is <em>test_new@gmail.com</em>, but I am getting test@gmail.com</p>
  <p>How can I solve this issue?</p>