Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FQL using facebook android SDK

I'm trying to create an android application using the facebook android SDK (http://github.com/facebook/facebook-android-sdk). I'm trying to figure out if I will be able to use FQL using this SDK. If anyone has any experiences in this regard, please let me know.

FQL can apparently be used using https://api.facebook.com/method/fql.query?query=QUERY, the facebook android SDK however doesn't seem to support this.

Thanks;

like image 992
Kumar Avatar asked Sep 19 '26 02:09

Kumar


1 Answers

This is probably a better way than mentioned. Using the current version of the API you don't need to manually add the access token or use Util.openURL.

        Bundle params = new Bundle();
        params.putString("method", "fql.query");
        params.putString("query", "SELECT name, uid, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) ORDER BY name");
        String response = $fb.request(params);
        response = "{\"data\":" + response + "}";

        JSONObject json = Util.parseJson( response );
        JSONArray data = json.getJSONArray( "data" );

        for ( int i = 0, size = data.length(); i < size; i++ ){
            JSONObject friend = data.getJSONObject( i );

            String id = friend.getString( "uid" );
            String name = friend.getString( "name" );
            ...
        }
like image 106
christoff Avatar answered Sep 21 '26 16:09

christoff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!