Is field expansion supported in Facebook's Android SDK? where can I find an example?
There is great documentation on field expansion for the Graph APi. However, I cannot find any documentation for the android-sdk-3. Is it supported?
The problem starts when you want to do the following:
/me?fields=name,birthday,photos.limit(10).fields(id, picture)
In Facebook android SDK it seems that adding the parameters as a string doesn't work
E.g.
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();
*get video data from faecbook by graph api and also put string in bundle *
The Android SDK is used to make Graph API queries
You make the API calls with the same parameters and same return values as when making raw HTTP calls to graph.facebook.com or using the Graph API Explorer tool -
Just change your existing calls to the API to include the additional fields you want, following the syntax in the Field Expansion documentation, e.g. if you're currently calling /me/friends
you can change it to /me/friends?fields=name,birthday
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With