相关疑难解决方法(0)

在Android中从Google Plus获取用户名

我已将Google plus与我的Android应用集成.一切正常,我也连接到谷歌加,但我无法得到当前用户的名称记录.

public void onConnected(Bundle connectionHint) {
    String personName="Unknown";
    if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
        Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
        personName = currentPerson.getDisplayName();
    }
}
Run Code Online (Sandbox Code Playgroud)

Plus.PeopleApi.getCurrentPerson(mGoogleApiClient)此方法始终返回null.

任何帮助将不胜感激.谢谢.

android google-api google-plus

10
推荐指数
3
解决办法
9718
查看次数

标签 统计

android ×1

google-api ×1

google-plus ×1