使用Play服务6.5.87的Google+登录(GoogleApiClient)-安卓

准将

在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文档已过时。希望您能够帮助我。谢谢。

尤拉·纳利维柯(Yura Nalivayko)

使用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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章