Google plus集成:无法加载可见的圈子

时间:2014-03-13 13:32:02

标签: android google-plus

我希望从我的应用中获取google plus的人员信息列表:朋友个人资料图片网址,可见名称和ID。

此处an official google plus integrating tutorial。我通过本教程制作了测试应用程序,并且遇到了错误:

Error requesting visible circles: Status{statusCode=NETWORK_ERROR, resolution=null}

实施Google Api客户端:

mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API, null)
            .addScope(Plus.SCOPE_PLUS_PROFILE)
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .build();

这里有关于结果:

@Override
public void onResult(People.LoadPeopleResult loadPeopleResult) {

    if (loadPeopleResult.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
        PersonBuffer personBuffer = loadPeopleResult.getPersonBuffer();
        try {
            int count = personBuffer.getCount();
            for (int i = 0; i < count; i++) {
                Log.d("TEST", "Display name: " + personBuffer.get(i).getDisplayName());
            }
        } finally {
            personBuffer.close();
        }
    } else {
        Log.e("TEST", "Error requesting visible circles: " + loadPeopleResult.getStatus());
    }
}

AndroidManifest.xml的权限:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

请帮助我,我需要做什么?

1 个答案:

答案 0 :(得分:1)

我修好了!我的问题是:我没有正确指定包: 像这样com.example,但正确的方法是com.example.moduledir