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 this post and implemented that.
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.
ie, suppose I have added [email protected] and linked that with Google Play, later I have added [email protected] and associated this account with play store, right now I am using Play store with this account. If I have wrote code as follows:
Account[] accountList = AccountManager.get(this).getAccountsByType("com.google");
Log.d("Play store account:" , accountList[0].name);
the expected out put for the statement is [email protected], but I am getting [email protected]
How can I solve this issue?