简体   繁体   English

如何以编程方式从Android上的gmail帐户获取个人资料和封面图片

[英]How to get the profile and cover picture from gmail account on android programmatically

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. 在我看来,至少在这种情况下,最好使用Google帐户。 So, I need to get the profile picture and cover picture from primary gmail account of an android device. 因此,我需要从android设备的主要gmail帐户中获取个人资料图片和封面图片。 Can anyone help me please? 谁能帮我吗? I'll be very much helped after all.. 毕竟,我会给您很大的帮助。

Use Google Android API to integrate Sign-in of primary gmail account into your app. 使用Google Android API将主要gmail帐户的登录功能集成到您的应用中。 Refer the official google sign-in documentation Google Sign-In for Android 请参阅官方的Google登录文档Google 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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取Gmail帐户的个人资料图片 - How to get profile picture of gmail account 如何在 android 应用程序中获取 google 帐户资料图片 - How to get google account profile picture in android app 如何从Android的Gmail帐户获取个人资料图片 - How can i get the profile image from my gmail account in android 如何以编程方式删除 android 中联系人的个人资料图片? - How to delete profile picture of a contact in android programmatically? 如何从所有者或Android上的gmail帐户获取电子邮件 - how to get email from owner or from gmail account on android 如何从Android App获取Facebook个人资料图片? - How to get Facebook profile picture from Android App? Facebook帐户套件集成在Android中获取Facebook个人资料图片 - Facebook Account kit Integration get facebook profile picture in android SocialAuth Android从Google获取个人资料图片 - Socialauth android get profile picture from google 我怎样才能收到正确的 url? 尝试从 firebase 应用程序中的 googlesignin 帐户获取个人资料图片 - How can I receive the correct url ? Trying to get the profile picture from the googlesignin account in firebase app 如何在Android中获取Facebook个人资料图片? - How to get Facebook profile picture in android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM