简体   繁体   English

使用适用于Android的新Google登录获取封面照片网址

[英]Getting cover photo url with the new Google Sign-In for Android

I'm trying to implement new Google sign-in ( com.google.android.gms:play-services-auth:8.4.0 ) to my app. 我正在尝试在我的应用中实施新的Google登录( com.google.android.gms:play-services-auth:8.4.0 )。 I'm following the tutorial here: https://developers.google.com/identity/sign-in/android/start-integrating . 我在这里遵循教程: https//developers.google.com/identity/sign-in/android/start-integrating I need to get cover photo url and couldn't find any documentation about how to get it using the classes like GoogleSignInResult or GoogleSignInAccount . 我需要获取封面照片网址,但无法找到有关如何使用GoogleSignInResultGoogleSignInAccount等类获取文档的任何文档。

In the old version, I was using Plus.PeopleApi.getCurrentPerson().getCover().getCoverPhoto().getUrl() method to get cover photo but it looks like in the new version they removed Plus class completely. 在旧版本中,我使用Plus.PeopleApi.getCurrentPerson().getCover().getCoverPhoto().getUrl()方法来获取封面照片,但它看起来像在新版本中他们完全删除了Plus类。

You can get the person Google+ profile data using the new sign in API. 您可以使用新的登录API获取Google+个人资料数据。 Use Person - Google APIs for Android in getting cover photo url . 使用Person - 适用于Android的Google API 获取封面照片网址

Sample code snippet below: 以下示例代码段:

Person.Cover.CoverPhoto cover = person.getCover().getCoverPhoto();
String coverUrl = cover.getUrl();

Here's a sample Demo app for Google Sign in: https://github.com/ngocchung/googlesignindemo 以下是Google登录的示例演示应用程序: https//github.com/ngocchung/googlesignindemo

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM