You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To get the user's name, if you are only supporting Android 4.0+, you can use the "me" contact in the Contacts list. (I'll add example code at the end). This requires both READ_CONTACTS and READ_PROFILE permission.
Getting their e-mail address is a bit trickier. The AccountManager has all the details of the accounts the user has on their device (really, all of them) but there could be multiple email accounts. (In fact, there can be multiple Google accounts).
If you use the AccountPicker (with the example usage they have there, which prompts for Google accounts) then you don't need the GET_ACCOUNTS permission, which is nice.
http://stackoverflow.com/questions/2112965/how-to-get-the-android-devices-primary-e-mail-address
https://gist.github.com/remelpugh/4072663
http://geekgarage.dad3zero.net/contact-informations-and-respect-privacy-android-development/
http://developer.android.com/reference/android/telephony/TelephonyManager.html
http://developer.android.com/reference/com/google/android/gms/common/AccountPicker.html
The text was updated successfully, but these errors were encountered: