您好我正在努力获得Google plus帐户的所有圈子。我使用Google Plus登录按钮验证了我的应用。
现在我想访问登录用户拥有的所有圈子 Circle Information Link
如何获取Google plus api for android的圈子列表
答案 0 :(得分:0)
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());
}
}