0

I followed the tutorial here: google-plus-integration

I have tried before a simple google sign-in api without problems. Reading the tutorial I wrote this code:

mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */,
                  this /* OnConnectionFailedListener */)
.addApi(Plus.API)
.addScope(Scopes.PLUS_LOGIN)
.addScope(Scopes.PLUS_ME)
.build();

Maybe I am stupid but this code gives me an error before compiling as:

addScoper(com.google.android.gms.commin.api.Scope) in Builder cannot be applided to String

I tried with new Scope(Scopes.PLUS_LOGIN) but when I run the app it crashes. Did Google really put up a broken code on their tutorial?

jayeshsolanki93
  • 2,096
  • 1
  • 20
  • 37
user3528466
  • 186
  • 2
  • 17

1 Answers1

0

Try Plus.SCOPE_PLUS_LOGIN instead (it returns Scope object)

mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */,
                  this /* OnConnectionFailedListener */)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.addScope(Plus.SCOPE_PLUS_PROFILE)
.build();

Refer this: Plus | Google APIs for Android

jayeshsolanki93
  • 2,096
  • 1
  • 20
  • 37