使用Facebook for Android发送请求

时间:2013-08-20 15:38:39

标签: android facebook

我正在使用facebook sdk 3.0.1 for Android。我已经按照教程和应用程序正常工作。唯一的问题是,即使我的应用程序说请求已成功发送,也没有人收到我的请求。这是我的代码:

private void sendRequestDialog() {



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

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

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

            })

   .build().show();
}'

0 个答案:

没有答案