Question

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

This my code to send invitation to friends id. The code can send the notification, but when i click the notification icon from the browser, the invitation is not present. Can anyone guide me how to send a message to friends facebook.

Was it helpful?

Solution

UPDATED:

Ignore my previous answer, I misinterpreted the type of dialog that you were trying to produce.

As mentioned in the comments, your code doesn't seem to be the problem since you are successfully getting a notification. Simply follow the steps in the Facebook app creation doc to make sure you are setting your app up correctly, specifying a Canvas URL as shown in the first image to make sure your app can provide invitations properly.

The examples on the same page should provide more help with using the URLs also.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top