在Play Services 6.1.71中,我使用了:
mPlusClient = new PlusClient.Builder(this,this,this).setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity").setScopes(Scopes.PLUS_LOGIN, Scopes.PROFILE).build();
但是在Google Play Services 6.5.87中,Google建议改为将PlusClient更改为GoogleApiClient.Builder。但是我无法像以前那样获取用户信息:
mPlusClient.getAccountName()
要么
mPlusClient.getCurrentPerson()
如何获取用户信息?我认为Google文档已过时。希望您能够帮助我。谢谢。
使用GoogleApiClient而不是PlusClient。样品:
mGoogleApiClient = new GoogleApiClient.Builder(mContext)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build();
要使用getAccountName(),请使用Plus.AccountApi.getAccountName(mGoogleApiClient)
要获取CurrentCurrentPerson (),请使用Plus.PeopleApi.getCurrentPerson(mGoogleApiClient)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句