How to increase the number of friends in Facebook Android App Request Dialog

712 Views Asked by At

So I'm using the recent version of the FB SDK I included as a maven dependency: compile 'com.facebook.android:facebook-android-sdk:3.20.0'

I'm trying to send an app request, but it only suggests 6 friends for me. Is there any way to make it suggest more, like 250?

Here's the code I'm using to send the request:

public static void openDialogInvite(final Activity activity)
{
    Bundle params = new Bundle();
    params.putString("message", "Join our app");

    Settings.setPlatformCompatibilityEnabled(true);

    WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(activity,
            Session.getActiveSession(), params))
            .setOnCompleteListener(new WebDialog.OnCompleteListener()
            {
                @Override
                public void onComplete(Bundle bundle, FacebookException error)
                {
                    if (error != null)
                    {
                        if (error instanceof FacebookOperationCanceledException ||
                                error instanceof FacebookServiceException)
                        {
                            Logger.d("Request canceled");
                        }
                        else
                        {
                            Logger.d("Network error");
                        }
                    }
                    else
                    {
                        final String requestId = bundle.getString("request");
                        if (requestId != null)
                        {
                            //kv Get fb ids of invited friends
                            //kv These are not in a string array as you might expect
                            //kv They are of the form:
                            //kv to[0]=id1, to[1]=id2, ...
                            ArrayList<String> to = new ArrayList<String>();
                            for (String key : bundle.keySet())
                            {
                                if (key.contains("to"))
                                {
                                    to.add(bundle.getString(key));
                                }
                            }
                        }
                    }
                }
            })
            .build();

    //kv Only show the Dialog if the Activity isn't finishing up, or else it could crash (BadTokenException)
    if (!activity.isFinishing())
    {
        requestsDialog.show();
    }
}
1

There are 1 best solutions below

1
On

There's no mechanism in the API to specify that you'd like to show more suggested friends. That said, the number isn't always 6 (although some people may only see 6), and we're always experimenting with new user experiences.

The user can also use the search field to type in names if they would like to invite specific friends.