Search code examples
androidfacebookfacebook-graph-apifacebook-friends

facebook request dialog android shows only a partial list of friends


Im trying to use facebook request dialog to enable the user to pick a friend to challenge in a turn based trivia android game. i dont have a web version of the game so i dont canvas. ive set up a request dialog that shows the list friends which works fine when i log in with facebook test users but when i login with my user who is also administrator of the facebook app then the dialog shows a list of only 5 friends. the dialog allows to search for more friends and when i do that i can search for other friends which do not appear in the list. my user has "public_profile","read_friendlists", "user_friends" permissions. the request dialog code

private void sendRequestDialog() {
    Bundle params = new Bundle();
    params.putString("message", "Learn how to make your Android apps social");
    params.putString("filters", "app_non_users");

    WebDialog requestsDialog = (
            new WebDialog.RequestsDialogBuilder(MainActivity.this,
                    //getActivity(),
                    Session.getActiveSession(),
                    params))
                    .setOnCompleteListener(new OnCompleteListener() {

                        @Override
                        public void onComplete(Bundle values,
                                FacebookException error) {
                            if (error != null) {
                                if (error instanceof FacebookOperationCanceledException) {
                                    Toast.makeText(getApplicationContext(),
                                            //getActivity().getApplicationContext(), 
                                            "Request cancelled", 
                                            Toast.LENGTH_SHORT).show();
                                } else {
                                    Toast.makeText(getApplicationContext(),
                                            //getActivity().getApplicationContext(), 
                                            "Network Error", 
                                            Toast.LENGTH_SHORT).show();
                                }
                            } else {
                                final String requestId = values.getString("request");
                                if (requestId != null) {
                                    Toast.makeText(getApplicationContext(),
                                            //getActivity().getApplicationContext(), 
                                            "Request sent",  
                                            Toast.LENGTH_SHORT).show();
                                } else {
                                    Toast.makeText(getApplicationContext(),
                                            //getActivity().getApplicationContext(), 
                                            "Request cancelled", 
                                            Toast.LENGTH_SHORT).show();
                                }
                            }   
                        }

                    })
                    .build();
    requestsDialog.show();
}

i dont understand why its not showing the entire friends list. please help. in addition, is this method of challenging a friend for a game is permitted by facebook is there another more recommended method?

Thanks!


Solution

  • user_friends will return only the friends who used the app that makes the request. via Graph API Reference