我正在做一些與Android/google_play_service庫和PlusClient的工作。具體來說,我只是使用我的聯繫人姓名填寫ListView,並在他們的G +個人資料頁面上提供一些基本信息。Android/PlusClient:loadPeople返回不完整的PersonBuffer對象在onPeopleLoaded
爲了加載列表,我進行如下:
// Create my PlusClient
activityContext = getActivity().getApplicationContext();
client = new PlusClient.Builder(activityContext, this, this)
.setScopes(Scopes.PLUS_PROFILE, Scopes.PLUS_LOGIN)
.build();
// Load the people
// this = the current activity
client.loadPeople(this, Person.Collection.VISIBLE);
// The below listener gets invoked when the list is loaded
... onPeopleLoaded(ConnectionResult cr, PersonBuffer pb, String nextPageToken) {
Person contact = null;
for (int i = 0; i < pb.getCount(); i++) {
contact = pb.get(i);
Log.d(TAG, contact.getDisplayName());
Log.d(TAG, contact.getAboutMe() == null ? "Null" : contact.getAboutMe());
Log.d(TAG, contact.getBirthday() == null ? "Null" : contact.getBirthday());
Log.d(TAG, contact.getEmails() == null ? "Null" : contact.getEmails().toString());
Log.d(TAG, contact.getCurrentLocation() == null ? "Null" : contact.getCurrentLocation());
Log.d(TAG, contact.getId() == null ? "Null" : contact.getId());
Log.d(TAG, contact.getLanguage() == null ? "Null" : contact.getLanguage());
Log.d(TAG, contact.getUrl() == null ? "Null" : contact.getUrl());
Log.d(TAG, contact.getName() == null ? "Null" : contact.getName().toString());
Log.d(TAG, contact.isPlusUser() ? "true" : "false");
Log.d(TAG, contact.isVerified() ? "true" : "false");
}
}
在上面的代碼段中,未返回null唯一方法是: - getDisplayName - 的getId - 使用getURL
...和我所有的聯繫人(幾百)。這看起來像包含在我的方法onPeopleLoaded中收到的PersonBuffer中的Person對象是不完整的。對於我的許多聯繫人,我在他們的G +個人資料上看到的信息是可見的(他們正在與我分享)...
在旁註中,我嘗試了API瀏覽器(https://developers.google.com/+/api/latest/people/get),仍然收到部分數據,但至少,下面的2個方法似乎是工作,而他們不是我的Android應用程序: - isPlusUser - isVerified
任何信息解釋這種行爲將不勝感激。