2

I am developing an android application and want to integrate with Google Drive. Successfully integrated with google drive by following the below guide from android developers https://developers.google.com/drive/android/auth

Here I want to get the connected account email id or Account name. How can I get email id or account name?

Previously I had used Plus API along with GoogleApiClient to get Profile information. But now Plus API is deprecated.

Please help to get Email id or account name while integrating with Google Drive in android.

Sathish
  • 1,481
  • 5
  • 20
  • 33
  • Check my answer here https://stackoverflow.com/questions/21501829/retrieve-account-name-with-the-new-google-drive-api/51203026#51203026 – thanhbinh84 Jul 06 '18 at 04:29

1 Answers1

0

Use the KEY_ACCOUNT_NAME constant which is belongs to the AccountManager object. Check the full code implementation in here.

With the email, I think you can obtain that using String personEmail = acct.getEmail(); from the Getting Profile Information but it's using Google Android Sign-in.

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
  • 1
    I have used KEY_ACCOUNT_NAME method to get the email id , but onActivityResult method data (Intent) is null. Do you have any idea why data is null? – Sathish May 26 '17 at 10:30