google play services - Getting the Gmail Id of the User In Android -
i don't know correct question or not.how can lo-gin id of user has been lo-gin google play store in android.is possible or not.
as per knowledge user has configure gmail account in android phone , gets access google play.
you can fetch account information given below (from jim blackler):
import android.accounts.account; import android.accounts.accountmanager; import android.content.context; /** * class uses accountmanager primary email address of * current user. */ public class useremailfetcher { static string getemail(context context) { accountmanager accountmanager = accountmanager.get(context); account account = getaccount(accountmanager); if (account == null) { return null; } else { return account.name; } } private static account getaccount(accountmanager accountmanager) { account[] accounts = accountmanager.getaccountsbytype("com.google"); account account; if (accounts.length > 0) { account = accounts[0]; } else { account = null; } return account; } }
in manifest
<uses-permission android:name="android.permission.get_accounts" />
Comments
Post a Comment