使用FQL Facebook的Android SDK中 [英] FQL using facebook android SDK
问题描述
我试图创建使用Facebook的Android SDK(http://github.com/facebook/facebook-android-sdk)Android应用程序。我试图找出如果我将能够使用该SDK使用FQL。如果任何人有这方面的经验,请让我知道。
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显然可以使用使用 https://api.facebook.com/方法/ fql.query?查询=查询,Facebook的Android SDK中却似乎并不支持这一点。
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.
感谢;
推荐答案
这是不是提到的可能是一个更好的办法。使用您无需手动添加访问令牌或使用Util.openURL API的当前版本。
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" );
...
}
这篇关于使用FQL Facebook的Android SDK中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!