Android Google plus无法加载用户
我尝试在我的Android应用程序中使用google plus api 我成功连接到google plus,并请求加载人员,但personBuffer计数为0。但是我的小组里有一些人 请告诉我你有什么想法吗?也许我忘记了任何附加范围?我只添加Scopes.PLUS\u登录名。在文档中,这就足够了 我的完整授权代码:Android Google plus无法加载用户,android,google-plus,Android,Google Plus,我尝试在我的Android应用程序中使用google plus api 我成功连接到google plus,并请求加载人员,但personBuffer计数为0。但是我的小组里有一些人 请告诉我你有什么想法吗?也许我忘记了任何附加范围?我只添加Scopes.PLUS\u登录名。在文档中,这就足够了 我的完整授权代码: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(s
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mPlusClient = new PlusClient.Builder(this, this, this).setScopes(Scopes.PLUS_LOGIN, Scopes.PLUS_PROFILE)
.setVisibleActivities("http://schemas.google.com/AddActivity").build();
// Progress bar to be displayed if the connection failure is not
// resolved.
mConnectionProgressDialog = new ProgressDialog(this);
mConnectionProgressDialog.setMessage("Signing in...");
}
@Override
protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
if (requestCode == REQUEST_CODE_RESOLVE_ERR && responseCode == RESULT_OK) {
mConnectionResult = null;
mPlusClient.connect();
}
}
@Override
public void onConnected(Bundle connectionHint) {
String accountName = mPlusClient.getAccountName();
// mPlusClient.loadPerson(this, "104242357859551899867");
//
mPlusClient.loadPeople(MainActivity.this, Person.Collection.VISIBLE);
Toast.makeText(this, accountName + " is connected. try to load persons", Toast.LENGTH_LONG).show();
}
@Override
public void onPeopleLoaded(ConnectionResult status, PersonBuffer personBuffer, String nextPageToken) {
Log.i("", "persons loaded result = " + status.toString() + ", personsCount = " + personBuffer.getCount()
+ ", token = " + nextPageToken);
if (status.isSuccess()) {
Iterator<Person> itP = personBuffer.iterator();
while (itP.hasNext()) {
Person person = itP.next();
Log.i("", person.getNickname());
}
}
}
@覆盖
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mpluclient=new PlusClient.Builder(this,this,this).setScopes(Scopes.PLUS\u登录,Scopes.PLUS\u配置文件)
.setVisibleActivities(“http://schemas.google.com/AddActivitybuild();
//如果未检测到连接故障,则显示进度条
//决心。
mConnectionProgressDialog=新建ProgressDialog(此);
设置消息(“登录…”);
}
@凌驾
ActivityResult上受保护的void(int请求代码、int响应代码、意图){
if(requestCode==请求\代码\解决\错误和响应代码==结果\确定){
mConnectionResult=null;
mpluclient.connect();
}
}
@凌驾
未连接的公共无效(捆绑连接提示){
字符串accountName=mpluclient.getAccountName();
//mpluclient.loadPerson(即“104242357859551899867”);
//
mpluclient.loadPeople(MainActivity.this、Person.Collection.VISIBLE);
Toast.makeText(此,accountName+“已连接。请尝试加载persons”,Toast.LENGTH_LONG.show();
}
@凌驾
public void onPeopleLoaded(ConnectionResult状态、PersonBuffer PersonBuffer、String nextPageToken){
Log.i(“,”persons loaded result=“+status.toString()+”,PersonCount=“+personBuffer.getCount()
+“,token=“+nextPageToken”);
if(status.issucess()){
迭代器itP=personBuffer.Iterator();
while(itP.hasNext()){
Person=itP.next();
Log.i(“,person.get昵称());
}
}
}
我的完整日志:
06-14 11:38:43.451: D/libEGL(779): loaded /system/lib/egl/libEGL_adreno200.so
06-14 11:38:43.451: D/libEGL(779): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
06-14 11:38:43.451: D/libEGL(779): loaded /system/lib/egl/libGLESv2_adreno200.so
06-14 11:38:43.451: I/Adreno200-EGL(779): <eglInitialize:269>: EGL 1.4 QUALCOMM build: Nondeterministic AU_full_mako_PARTNER-ANDROID/JB-MR1-DEV_CL2961380_release_AU (CL2961380)
06-14 11:38:43.451: I/Adreno200-EGL(779): Build Date: 12/10/12 Mon
06-14 11:38:43.451: I/Adreno200-EGL(779): Local Branch:
06-14 11:38:43.451: I/Adreno200-EGL(779): Remote Branch: m/partner-android/jb-mr1-dev
06-14 11:38:43.451: I/Adreno200-EGL(779): Local Patches: NONE
06-14 11:38:43.451: I/Adreno200-EGL(779): Reconstruct Branch: NOTHING
06-14 11:38:43.491: D/OpenGLRenderer(779): Enabling debug mode 0
06-14 11:38:44.993: I/(779): persons loaded result = ConnectionResult{statusCode=SUCCESS, resolution=null}, personsCount = 0, token = null
06-14 11:38:45.013: D/dalvikvm(779): GC_CONCURRENT freed 165K, 3% free 8898K/9092K, paused 2ms+3ms, total 27ms
06-1411:38:43.451:D/libEGL(779):loaded/system/lib/egl/libEGL_adreno200.so
06-14 11:38:43.451:D/libEGL(779):loaded/system/lib/egl/libGLESv1_CM_adreno200.so
06-14 11:38:43.451:D/libEGL(779):loaded/system/lib/egl/libGLESv2_adreno200.so
06-14 11:38:43.451:I/Adreno200 EGL(779)::EGL 1.4高通公司构建:不确定的AU_full_mako_PARTNER-ANDROID/JB-MR1-DEV_CL2961380_release_AU(CL2961380)
06-14 11:38:43.451:I/Adreno200 EGL(779):建造日期:12/10/12周一
06-14 11:38:43.451:I/Adreno200 EGL(779):当地分行:
06-14 11:38:43.451:I/Adreno200 EGL(779):远程分支:m/partner android/jb-mr1-dev
06-14 11:38:43.451:I/Adreno200 EGL(779):局部斑块:无
06-14 11:38:43.451:I/Adreno200 EGL(779):重建分支:无
06-14 11:38:43.491:D/OpenGLRenderer(779):启用调试模式0
06-14 11:38:44.993:I/(779):人员加载结果=连接结果{statusCode=SUCCESS,resolution=null},人员计数=0,令牌=null
6-14 11:38:45.013:D/dalvikvm(779):GC_并发释放165K,3%释放8898K/9092K,暂停2ms+3ms,总计27ms
解决方法是如下初始化PlusClient:
mPlusClient = new PlusClient.Builder(this, this, this).build();
以上代码工作正常。确保您的google plus帐户具有所有详细信息,或尝试使用其他google plus帐户登录我尝试登录另一个帐户,所有这些都是一样的,请粘贴完整的日志。我正在向Post添加完整的日志。您想加载个人还是个人?