Gopi Ram Choudhary
Gopi Ram Choudhary

Reputation: 61

how to send invitation on Facebook in Android?

I am trying to send invitation from my app to facebook friends. everything is working fine, facebook invitation dialog is being shown, my frinds list is there, I am also receiving status in onComplete but on the other side (to whom I send invitation) nothing happens. not notification is being sent to my frinds. please let me know where I am wrong. below is my code.

private void inviteFriends() {
        try {
            Bundle params = new Bundle();
            params.putString("title", "invite friends");
            params.putString("message", "come join us!");
            mFacebook.dialog(this, "apprequests", params, new DialogListener() {
                @Override
                public void onComplete(Bundle values) {

                    try {
                        // JSONObject eventResponse = new JSONObject(response);
                        // event_id = event.getString("id");
                        /*
                         * Log.i(TAG, "Event Response => "+eventResponse);
                         * Log.w("myapp", friends);
                         */

                        System.out.println("fb invite response "
                                + values.toString());
                        Toast.makeText(getApplicationContext(), "Request sent",
                                Toast.LENGTH_SHORT).show();

                        // Toast.makeText(getApplicationContext(),
                        // "New Event Created!!", Toast.LENGTH_LONG).show();
                    } catch (Exception e) {

                    }

                }

                @Override
                public void onFacebookError(FacebookError error) {
                }

                @Override
                public void onCancel() {
                }

                @Override
                public void onError(DialogError e) {
                    // TODO Auto-generated method stub

                }

            });
        } catch (Exception e) {

        }
}

now problem is that request is sent but notification comes in facebook app not in facebook browser?

Upvotes: 3

Views: 1218

Answers (1)

andyrandy
andyrandy

Reputation: 73984

You should use the Message Dialog to invite friends in an Android App, the App Requests are only for Canvas Games: https://developers.facebook.com/docs/apps/faq#invite_to_app

(See "If your app does not have a presence on Facebook Canvas")

More information: https://developers.facebook.com/docs/android/share#message-dialog

Upvotes: 2

Related Questions