webdialog没有向Facebook好友发送请求

时间:2014-05-26 13:20:59

标签: android facebook sdk

    private void sendRequestDialog() {
    Bundle params = new Bundle();
    params.putString("message", "Message");

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

                @Override
                public void onComplete(Bundle values,
                        FacebookException error) {
                    // TODO Auto-generated method stub

                     if (error != null) {
                            if (error instanceof FacebookOperationCanceledException) {
                                Toast.makeText(a.getApplicationContext(), 
                                    "Request cancelled", 
                                    Toast.LENGTH_SHORT).show();
                            } else {
                                Toast.makeText(a.getApplicationContext(), 
                                    "Network Error", 
                                    Toast.LENGTH_SHORT).show();
                            }
                        } else {
                            final String requestId = values.getString("request");
                           // final String[] to = values.getStringArray("to");
                            if (requestId != null) {
                                Toast.makeText(a.getApplicationContext(), 
                                    "Request sent",  
                                    Toast.LENGTH_SHORT).show();

                               // Log.i("To", to.toString());
                            } else {
                                Toast.makeText(a.getApplicationContext(), 
                                    "Request cancelled", 
                                    Toast.LENGTH_SHORT).show();
                            }
                        }   

                }

            })
            .build();
    requestsDialog.show();
    }

............................................... .................................................. .................................................. .................................................. .................................................. .................................................. ........ 此代码返回“请求已发送”,但实际上没有发送请求 我从FaceBook文档中复制了这段代码 ......有什么帮助吗?

0 个答案:

没有答案