我无法从 Google Plus 获取用户详细信息
I cannot get user details from Google Plus
Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) returns 行为空,即使我已经登录并且我的应用程序已经连接到该帐户。
这是我的代码:
@Override
public void onConnected(Bundle connectionHint) {
mSignInClicked = false;
Toast.makeText(this, "User is connected!", Toast.LENGTH_LONG).show();
Plus.PeopleApi.loadVisible(mGoogleApiClient, null).setResultCallback(this);
String personName = "No one!";
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
personName = currentPerson.getDisplayName();
String personGooglePlusProfile = currentPerson.getUrl();
Toast.makeText(this, "Welcome " + personName, Toast.LENGTH_LONG).show();
}
}
日志猫还显示:
请求可见圈子时出错:Status{statusCode=NETWORK_ERROR,resolution = null}
您需要在 Google 开发者控制台中启用 Google+ API。
Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) returns 行为空,即使我已经登录并且我的应用程序已经连接到该帐户。
这是我的代码:
@Override
public void onConnected(Bundle connectionHint) {
mSignInClicked = false;
Toast.makeText(this, "User is connected!", Toast.LENGTH_LONG).show();
Plus.PeopleApi.loadVisible(mGoogleApiClient, null).setResultCallback(this);
String personName = "No one!";
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
personName = currentPerson.getDisplayName();
String personGooglePlusProfile = currentPerson.getUrl();
Toast.makeText(this, "Welcome " + personName, Toast.LENGTH_LONG).show();
}
}
日志猫还显示: 请求可见圈子时出错:Status{statusCode=NETWORK_ERROR,resolution = null}
您需要在 Google 开发者控制台中启用 Google+ API。