【问题标题】:How to increase the number of friends in Facebook Android App Request Dialog如何在 Facebook Android App Request Dialog 中增加好友数量
【发布时间】:2014-12-17 19:26:12
【问题描述】:

所以我正在使用我作为 maven 依赖项包含的最新版本的 FB SDK: 编译'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();
    }
}

【问题讨论】:

    标签: android facebook facebook-invite


    【解决方案1】:

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

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

    【讨论】:

    • 感谢小明的回复!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多