4

I am trying to send invitation to facebook friends using Facebook sdk 3.1. Here is code:

Bundle params = new Bundle();
params.putString("message", "Come join me in the GuessWhat!");
params.putString("to", TextUtils.join(",", invitableTokens));

WebDialog dialog = new WebDialog.Builder(context, Session.getActiveSession(), action, params).setOnCompleteListener(
            new WebDialog.OnCompleteListener() {

                @Override
                public void onComplete(Bundle values, FacebookException error) {

                    if(error!=null)
                        Log.i(getClass().getSimpleName(), "Invitation Error :" + error.getMessage());
                    else
                        Utils.showToast_msg(context, getString(R.string.invite_sent));

                }
            }).build();

    // Hide the notification bar and resize to full screen
    Window dialog_window = dialog.getWindow();
    dialog_window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // Show the dialog
    dialog.show();

Using webdialog it opens up a dialog to add friends to send invites. Invitation is sent successfully. But it does not received by receiver. If i add a paltform "Facebook canvas" then it sends invitation and friend receives the invitation but on clicking the invite it redirects to Facebook canvas (nothing is there to show). I simply want to send app invites to facebook friends (without Facebook canvas) and when click on invite it should redirect to Google play store to open the app. Any suggestions?

Nouman Bhatti
  • 1,777
  • 4
  • 28
  • 55

1 Answers1

0

Better to shift to 4.0 FB Api version because. To send app invites you must use version 4.0 or later of the Facebook Android SDK. Read more about getting started with the Facebook SDK for Android to properly setup for you environment.

for more details check Facebook Developer Portal.

Usman Nisar
  • 3,031
  • 33
  • 41
  • I cant shift to sdk 4.0 because i have implemented sdk 3.0 all over the app. Now dont have much time to change whole code accordingly – Nouman Bhatti Aug 06 '15 at 07:58