繁体   English   中英

如何从Android上的Graph API获取朋友的Facebook ID列表?

[英]How to get a list of friend's Facebook ID's from Graph API on Android?

我发现了这个问题 ,它确实可以实现我想要的功能,但是不建议使用Facebook类,而推荐使用Facebook Graph API。 我无法理解Facebook提供的文档,因此,如果有人可以提供帮助,将不胜感激!

我建议您查看支持Graph API的Facebook Android SDK (受Facebook支持)。

它有一个可以满足您需求的Android FriendPicker示例。

public void getIds(){
    Session session = Session.getActiveSession();
    String fqlQuery = "select uid from user where uid in (select uid2 from friend where uid1 = me())";
    Bundle params = new Bundle();
    params.putString("q", fqlQuery);
    Request request = new Request(session, "/fql", params, HttpMethod.GET,
            new Callback() {

                @Override
                public void onCompleted(Response response) {

                    Log.d("List of id's", "response = "+response);
                }
            });
    Request.executeBatchAsync(request); 
}
public void getIds(){
            Session session = Session.getActiveSession();
            String query = "select uid from user where uid in (select uid2 from friend where uid1 = me())";
            Bundle params = new Bundle();
            params.putString("q", query);
            Request request = new Request(session, "/me/friends", params, HttpMethod.GET, new Request.Callback() {

                        @Override
                        public void onCompleted(Response response) {

                            Log.d("Id's :", "Response = "+response);
                        }
                    });
            Request.executeBatchAsync(request); 
        }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM