首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >让所有用户圈子,然后让人们站在Google Plus android旁边

让所有用户圈子,然后让人们站在Google Plus android旁边
EN

Stack Overflow用户
提问于 2015-03-04 02:11:30
回答 1查看 140关注 0票数 1

嗨,我正在尝试得到所有的圈子,我为谷歌加帐户。我使用Google Plus登录按钮验证了我的应用程序。

现在,我想要访问登录用户拥有Circle Information Link的所有圈子

如何使用Google plus api for android获取圈子列表

EN

回答 1

Stack Overflow用户

发布于 2015-03-04 02:19:45

To get list of circles

代码语言:javascript
代码运行次数: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;
  }
}

To get people inside circles

代码语言:javascript
代码运行次数:0
运行
复制
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());
  }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28838922

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档