如何增加Facebook Android App Request对话框中的朋友数量

时间:2014-12-17 19:26:12

标签: android facebook facebook-invite

所以我使用最近版本的FB SDK作为maven依赖项: 编译' com.facebook.android:facebook-android-sdk:3.20.0'

我试图发送应用请求,但它只为我建议了6个朋友。有没有办法让它更多,比如250?

以下是我用来发送请求的代码:

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 个答案:

答案 0 :(得分:2)

API中没有任何机制可以指定您希望显示更多建议的朋友。也就是说,这个数字并不总是6(尽管有些人可能只看到6),而且我们一直在尝试新的用户体验。

如果用户想邀请特定的朋友,也可以使用搜索字段输入姓名。