Android - Google+登录

时间:2014-08-17 03:05:03

标签: android google-plus

我正在遵循https://developers.google.com/+/mobile/android/sign-in?hl=pt-PT的教程,并且我在启用登录时遇到了一些困难。

在第2步,我已将代码复制到我的登录片段(我的facebook登录工作顺利),我在Plus客户端上收到错误:

- mPlusClient cannot be resolved to a variable
- The method setVisibleActivities(String, String) is undefined for the type PlusClient.Builder
- The constructor PlusClient.Builder(SplashFragment, SplashFragment, SplashFragment) is undefined

我无法理解我失败的地方,因为我已多次听过教程。

3 个答案:

答案 0 :(得分:2)

本教程已更新为英文版。您可以从https://developers.google.com/+/mobile/android/getting-started?hl=en查看。 他们现在使用GoogleApiClient。

mGoogleApiClient = new GoogleApiClient.Builder(this)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .addApi(Plus.API)
    .addScope(Plus.SCOPE_PLUS_LOGIN)
    .build();

答案 1 :(得分:1)

该页面的葡萄牙语版本似乎尚未更新到最新的API,因此您在尝试使用旧API时遇到错误(此后已弃用)。请考虑使用english version代替。

答案 2 :(得分:1)

您还可以使用Social-Auth Library轻松集成多个社交平台......

  

SocialAuth Android是流行的SocialAuth Java库的Android版本。现在,如果要将应用程序与多个社交网络集成,则无需集成多个SDK。在应用程序中集成SocialAuth Android库后,您只需添加几行代码。

Social Auth