我设法获取了我的个人资料的教育和工作字段,但我想知道是否有可能为特定用户获取它?如果是这样,它的Graph API语句是什么?
这就是我在Android Studio中设法完成的工作;
private Request newRequest(Session session) {
Request request = Request.newGraphPathRequest(session, "/me", null);
Set<String> fields = new HashSet<String>();
String[] requestFields = new String[]{"work, education"};
fields.addAll(Arrays.asList(requestFields));
Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);
return request;
}
答案 0 :(得分:1)
您应始终将/me
与相应的用户访问令牌一起使用。没有它,您无论如何都无法收到用户特定的信息。
见
答案 1 :(得分:1)
传递用户的FB ID和我想要访问的字段,如果它返回我正在寻找的内容,怎么会出错呢?
private Request newRequest(Session session) {
Request request = Request.newGraphPathRequest(session, profile.getFacebook_id(), null);
Set<String> fields = new HashSet<String>();
String[] requestFields = new String[]{"work, education"};
fields.addAll(Arrays.asList(requestFields));
Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);
return request;
}
答案 2 :(得分:0)