Nouman Bhatti
Nouman Bhatti

Reputation: 1837

Android Invite friends to App (open play store link) using Facebook Sdk 3.1

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?

Upvotes: 4

Views: 896

Answers (1)

Usman Nisar
Usman Nisar

Reputation: 3081

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.

Upvotes: 0

Related Questions