Skip to content Skip to sidebar Skip to footer

Facebook Sdk V3.0 Request Dialog Not Sending Application Request

I am using Android SDK v3.0 for Facebook to send requests to friends for using my app. I've used the code I saw on here to open up Facebook's Dialog app and make a request to the u

Solution 1:

From this Facebook developers page: "User to User Requests are only available for Canvas apps"

Solution 2:

In app setting in facebook developer account add a canvas framework and after that add below code to send app request. if in activity replace getActivity() with YourActivityName.this if in fragment no need to replace anything

Bundleparams=newBundle();
            params.putString("message",
                    "Join CConnect To feel Better Experience Of Meetings And Calls");

            WebDialogrequestsDialog= (newWebDialog.RequestsDialogBuilder(
                    getActivity(), Session.getActiveSession(), params))
                    .setTheme(
                            android.R.style.Theme_Translucent_NoTitleBar_Fullscreen))
                    .setOnCompleteListener(newOnCompleteListener() {

                        @OverridepublicvoidonComplete(Bundle values,
                                FacebookException error) {
                            if (error != null) {
                                if (error instanceof FacebookOperationCanceledException) {
                                    Toast.makeText(
                                            getActivity()
                                                    .getApplicationContext(),
                                            "Request cancelled",
                                            Toast.LENGTH_SHORT).show();
                                } else {
                                    Toast.makeText(
                                            getActivity()
                                                    .getApplicationContext(),
                                            "Network Error", Toast.LENGTH_SHORT)
                                            .show();
                                }
                            } else {
                                finalStringrequestId= values
                                        .getString("request");
                                if (requestId != null) {
                                    Toast.makeText(
                                            getActivity()
                                                    .getApplicationContext(),
                                            "Request sent", Toast.LENGTH_SHORT)
                                            .show();
                                } else {
                                    Toast.makeText(
                                            getActivity()
                                                    .getApplicationContext(),
                                            "Request cancelled",
                                            Toast.LENGTH_SHORT).show();
                                }
                            }
                        }

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

Post a Comment for "Facebook Sdk V3.0 Request Dialog Not Sending Application Request"