简体   繁体   English

如何在Facebook 3.0 Android中向所有Facebook朋友发送请求

[英]How to Send Request to all facebook friends in facebook 3.0 android

i have to send app request to all friends here i am using this code for send request to only one friend it's working fine but i want to send request to multiple/all friends 我必须在这里向所有朋友发送应用程序请求,我正在使用此代码仅向一个朋友发送请求,它工作正常,但我想向多个/所有朋友发送请求

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

    WebDialog requestsDialog = (new WebDialog.RequestsDialogBuilder(
            Logout.this, Session.getActiveSession(), params))
            .setOnCompleteListener(new OnCompleteListener() {
                @Override
                public void onComplete(Bundle values,
                        FacebookException error) {
                    if (error != null) {
                        if (error instanceof FacebookOperationCanceledException) {
                            Toast.makeText(
                                    Logout.this.getApplicationContext(),
                                    "Request cancelled", Toast.LENGTH_SHORT)
                                    .show();
                        } else {
                            Toast.makeText(
                                    Logout.this.getApplicationContext(),
                                    "Network Error", Toast.LENGTH_SHORT)
                                    .show();
                        }
                    } else {
                        final String requestId = values
                                .getString("request");
                        if (requestId != null) {
                            Toast.makeText(
                                    Logout.this.getApplicationContext(),
                                    "Request sent", Toast.LENGTH_SHORT)
                                    .show();
                        } else {
                            Toast.makeText(
                                    Logout.this.getApplicationContext(),
                                    "Request cancelled", Toast.LENGTH_SHORT)
                                    .show();
                        }
                    }
                }
            }).build();
    requestsDialog.show();
}

here i am passing facebook id of one friend how could i send to all/multiple friends i have facebook id of all friends i need urgently Thanks Advance :) 在这里,我正在传递一个朋友的Facebook ID,我该如何发送给所有/多个朋友?我有我急需的所有朋友的Facebook ID。感谢Advance :)

Just remove this line params.putString("to", "1782990807"); 只需删除此行params.putString(“ to”,“ 1782990807”); and choose friends.You can choose multiple friends. 并选择朋友。您可以选择多个朋友。

The Facebook SDK for Android provides a method to let you publish stories from your app to a user's timeline. 适用于Android的Facebook SDK提供了一种方法,可让您将应用程序中的故事发布到用户的时间轴。 You can also use this method to post a status update on your user's behalf. 您也可以使用此方法代表用户发布状态更新。 This method uses the Graph API, and is an alternative to using the Feed Dialog 此方法使用Graph API,并且是使用Feed对话框的替代方法

http://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/ http://developers.facebook.com/docs/howtos/androidsdk/3.0/publish-to-feed/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM