Reputation: 157
Actually, I am developing an app with a navigation drawer. So, I need one profile picture and one background picture to make it charming. Google account is best in this case at least in my eyesight. So, I need to get the profile picture and cover picture from primary gmail account of an android device. Can anyone help me please? I'll be very much helped after all..
Upvotes: 1
Views: 996
Reputation: 1001
Use Google Android API to integrate Sign-in of primary gmail account into your app. Refer the official google sign-in documentation Google Sign-In for Android
After following the above documentation, you can get the profile information(display name and profile image) by belowed code :
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
GoogleSignInAccount acct = result.getSignInAccount();
String personName = acct.getDisplayName();
String personEmail = acct.getEmail();
String personId = acct.getId();
Uri personPhoto = acct.getPhotoUrl();
Upvotes: 2