Ray*_*ejo 5 android facebook facebook-android-sdk facebook-field-expansion
Facebook的Android SDK是否支持现场扩展?我在哪里可以找到一个例子?
有关Graph APi的字段扩展的很好的文档.但是,我找不到android-sdk-3的任何文档.是否支持?
当您要执行以下操作时,问题就开始了:
/me?fields=name,birthday,photos.limit(10).fields(id, picture)
Run Code Online (Sandbox Code Playgroud)
在Facebook android SDK中,似乎将参数添加为字符串不起作用
例如
request = Request.newGraphPathRequest(session, "me/friendlists", new Request.Callback() {
public void onCompleted(Response response) ...
}
Bundle parameters = new Bundle();
parameters.putString("fields","members.fields(id)", "list_type");
request.setParameters(parameters);
Run Code Online (Sandbox Code Playgroud)
Session session = Session.getActiveSession();
Bundle parameters = new Bundle();
parameters.putString("fields","picture,description,source");
new Request(session, /me/videos/uploaded, parameters, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
GraphObject responseGraphObject = response
.getGraphObject();
JSONObject json = responseGraphObject
.getInnerJSONObject();
try {
JSONArray array = json.getJSONArray("data");
for (int i = 0; i < array.length(); i++) {
JSONObject main = array.getJSONObject(i);
String surce = main.optString("source");
String picture = main.optString("picture");
String videoname = main
.optString("description");
System.out.println(surce);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}).executeAsync();
Run Code Online (Sandbox Code Playgroud)
*通过图表api从faecbook获取视频数据,并将字符串放入包中*
Android SDK用于进行Graph API查询
您可以使用与对 graph.facebook.com 进行原始 HTTP 调用或使用Graph API Explorer工具时相同的参数和相同的返回值进行 API 调用-
只需更改对 API 的现有调用以包含所需的其他字段,遵循字段扩展文档中的语法即可,例如,如果您当前正在调用,/me/friends则可以将其更改为/me/friends?fields=name,birthday
| 归档时间: |
|
| 查看次数: |
2636 次 |
| 最近记录: |