嗨,我正在尝试得到所有的圈子,我为谷歌加帐户。我使用Google Plus登录按钮验证了我的应用程序。
现在,我想要访问登录用户拥有Circle Information Link的所有圈子
如何使用Google plus api for android获取圈子列表
发布于 2015-03-03 18:19:45
import java.util.List;
import com.google.api.services.plusDomains.model.Circle;
import com.google.api.services.plusDomains.model.CircleFeed;
PlusDomains.Circles.List listCircles = plusDomains.circles().list("me");
listCircles.setMaxResults(5L);
CircleFeed circleFeed = listCircles.execute();
List<Circle> circles = circleFeed.getItems();
// Loop until no additional pages of results are available.
while (circles != null) {
for (Circle circle : circles) {
System.out.println(circle.getDisplayName());
}
// When the next page token is null, there are no additional pages of
// results. If this is the case, break.
if (circleFeed.getNextPageToken() != null) {
// Prepare the next page of results
listCircles.setPageToken(circleFeed.getNextPageToken());
// Execute and process the next page request
circleFeed = listCircles.execute();
circles = circleFeed.getItems();
} else {
circles = null;
}
}
import com.google.api.services.plusDomains.model.PeopleFeed;
String circleId = "a1234b";
PlusDomains.People.ListByCircle listPeople = plusDomains.people().listByCircle(circleId);
listPeople.setMaxResults(100L);
PeopleFeed peopleFeed = listPeople.execute();
System.out.println("Google+ users circled:");
// This example only displays one page of results.
if(peopleFeed.getItems() != null && peopleFeed.getItems().size() > 0 ) {
for(Person person : peopleFeed.getItems()) {
System.out.println("\t" + person.getDisplayName());
}
}
https://stackoverflow.com/questions/28838922
复制相似问题