Get friend list facebook 3.0

前端 未结 7 896
感情败类
感情败类 2020-12-12 22:57

I\'m trying to obtain my friend list from facebook using new SDK(3.0). I\'m facing problems related to what kind of params I need to insert in a Bundle and how to use newMyF

7条回答
  •  我在风中等你
    2020-12-12 23:09

    You can use my code, you need to use the facebook library in your project. All the classes used for facebook are there in that sdk.

    private void onSessionStateChange(Session session, SessionState state,
            Exception exception) {
        if (state.isOpened()) {
            Log.i(TAG, "Logged in...");
            Request.executeMyFriendsRequestAsync(session,
                    new GraphUserListCallback() {
    
                        @Override
                        public void onCompleted(List users,
                                Response response) {
                            Log.i("Response JSON", response.toString());
                            names = new String[users.size()];
                            id = new String[users.size()];
                            for (int i=0; i

    names and ids are two String arrays and now have all the names and ids of the friends. I hope it solves your problem.

提交回复
热议问题