我正在使用 facebook4j API。我想获取我 friend 的个人资料详细信息,如教育、就业等。但我目前得到的只是姓名和性别。 尽管我按照url中的规定为我的 friend 提供了所有扩展权限,例如friends_education_history等。
现在我还没有得到我 friend 的完整个人资料详细信息。我如何实现这个目标
ResponseList<Friend> friends = facebook.getFriends();
是否可以选择获取公开资料的教育背景和工作经历?
最佳答案
我从未使用过 Facebook4j API,但我会尝试一下。 Friend
实现了 User
,因此您可以在 Friend
对象上使用 User
方法。
ResponseList<Friend> friends = facebook.getFriends();
for (Friend facebookFriend : facebookFriends) {
List<Education> educations = facebookFriend.getEducation();
for (Education e : educations) {
/* do anything with the Education object */
System.out.println("School: " + e.toString());
}
List<Work> works = facebookFriend.getWork();
for (Work w : works) {
/* do anything with the Work object */
System.out.println("Work: " + w.toString());
}
}
文档:
关于java - 获取 Facebook 好友个人资料详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17467486/