如何得到各界朋友的姓名,身份证,生日,地点等。来自Facebook的API中的android? [英] How to get all friends name, id, birthday, location, etc.. from facebook API in android?

查看:112
本文介绍了如何得到各界朋友的姓名,身份证,生日,地点等。来自Facebook的API中的android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  <一href="http://stackoverflow.com/questions/3393610/how-to-get-friends-birthday-list-using-facebook-api">How得到朋友的生日列表使用Facebook的API?

我想显示包含如姓名,身份证,生日,地点从Facebook的Andr​​oid应用程序的信息列表。

I want to display the list that contain information like name, id, birthday, location from facebook in android application.

我在工作的顺利击败,虽然下面的code我已经得到了朋友的姓名和身份证

I am beat successful in work though the following code I have get the friend's name and ID

           Bundle parameters = new Bundle();
    mAccessToken = facebook.getAccessToken();

    try {

        parameters.putString("format", "json");
        parameters.putString(TOKEN, mAccessToken);

        String url = "https://graph.facebook.com/me/friends";
        String response = Util.openUrl(url, "GET", parameters);
        JSONObject obj = Util.parseJson(response);

        Log.i("json Response", obj.toString());
        JSONArray array = obj.optJSONArray("data");

        if (array != null) {
            for (int i = 0; i < array.length(); i++) {
                String name = array.getJSONObject(i).getString("name");

                String id = array.getJSONObject(i).getString("id");

                Log.i(name,id);
            }
        } 

                ............
                ............

但没有得到生日,地点,JSON响应等领域。 什么是错?

but not get birthday, location, etc fields in json response. what is mistake?

推荐答案

使用FQL语言很快得到所有你想要的信息:

Use the FQL language to get very quickly all the information you want:

$this->api->api(array('method'=>'fql.query','query'=>"SELECT uid,name,first_name,middle_name,last_name,pic_square,hometown_location,current_location,profile_url,email,website FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())"));

有关所有表及其相应的列名的列表,我指的是: Facebook的FQL参考

For a list of all the tables with their corresponding column names I refer to: Facebook FQL Reference

这篇关于如何得到各界朋友的姓名,身份证,生日,地点等。来自Facebook的API中的android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆