Facebook 的 Android SDK 是否支持字段扩展?我在哪里可以找到示例?
关于 Graph API 的字段扩展有很好的文档。但是,我找不到 android-sdk-3 的任何文档。是否支持?
当您想执行以下操作时,问题就开始了:
/me?fields=name,birthday,photos.limit(10).fields(id, picture)
在 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);
最佳答案
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();
*通过graph api从faecbook获取视频数据并将字符串放入bundle *
关于android - Android 应用中的 Facebook Graph API 字段扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14574509/