在我使用的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文档已过时。 希望您能够帮助我。谢谢。
答案 0 :(得分:6)
使用 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)
getCurrentPerson()使用 Plus.PeopleApi.getCurrentPerson(mGoogleApiClient)
答案 1 :(得分:0)
非常好example如何使用GoogleApiClient实现登录... 因为它是整个教程,所以我不在这里复制它。