无法使用新API连接到Google+

时间:2015-05-22 10:00:35

标签: android google-api google-plus

我无法使用start integrating Google+ into your Android app连接到Google+。

它很简单,但是新的com.google.android.gms:play-services-plus:7.3.0类PlusClient和PlusClient.Bulder无法解析。我需要通过电子邮件获取用户信息,例如:头像的网址和名字/姓氏。

你能帮助我吗?

P.S:当我添加到gradle dependensies com.google.android.gms:play-services:6.1.71类PlusClient可以解决,但我超出了方法的限制。当我只添加play-services-plus时,它不起作用

1 个答案:

答案 0 :(得分:0)

PlusClient.Bulder已从版本号23中删除,现在google play services版本号为24.

您可以使用

访问google plus登录信息
     private GoogleApiClient buildGoogleApiClient() {
    // When we build the GoogleApiClient we specify where connected and
    // connection failed callbacks should be returned, which Google APIs our
    // app uses and which OAuth 2.0 scopes our app requests.
    return new GoogleApiClient.Builder(SigninActivity.this).addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this).addApi(Plus.API, Plus.PlusOptions.builder().build())
            .addScope(Plus.SCOPE_PLUS_LOGIN).build();
  }

在您的活动类中调用此方法,并像这样分配GoogleApiClient的实例

 GoogleApiClient  mPlusClient = buildGoogleApiClient();

请按照此link进行完整处理。