Forum Xamarin Xamarin.Android

Has anyone had success using Xamarin.Facebook AppInviteDialog?

I am using the latest NuGet package "Facebook SDK for Xamarin" Version

So far I manage to bring up a Facebook app invite dialog, select a friend, and then send the invite on its way. It appears to be working however the invite is never received by any of my Facebook friends. I have also noticed that I never get a result from the callbacks which makes me think something wrong.

Any thoughts?

Thank You

    const String APP_LINK_URL = @""; // Hiding actual values from public.
    const String PREVIEW_IMAGE_URL = @""; // Hiding actual values from public.

    ICallbackManager _callBackManager;
    CCallback _callBack;
    AppInviteDialog _appInviteDialog;

    public Boolean DoAppInvite(Activity Activity) {
        try {
            if (!_bIsInitialized)

            if (!_bIsCanShow)
                return false;

            _callBackManager = CallbackManagerFactory.Create();

            AppInviteContent aic = (AppInviteContent)new AppInviteContent.Builder()

            _appInviteDialog = new AppInviteDialog(Activity);
            _callBack = new CCallback();
            _appInviteDialog.RegisterCallback(_callBackManager, _callBack);

            return true;
        } catch (Exception ex) {
            CCommon.LogError("DoAppInvite Exception", ex);
            return false;

} // class...

public class CCallback : Java.Lang.Object, IFacebookCallback {
    public void OnCancel() {
        CCommon.LogWarn("CFacebookAppInvites: Canceled.");

    public void OnError(FacebookException error) {
        CCommon.LogError("CFacebookAppInvites: Exception: " + error.Message);

    public void OnSuccess(Java.Lang.Object result) {
        CCommon.LogInfo("CFacebookAppInvites Success");
} // class...


  • BradCrandallBradCrandall USMember ✭✭

    I spent more time on this problem and created a new application from scratch to help simplify the problem. The code below works. I am now able to get a SUCCESS response from the Facebook SDK, however, none of my Facebook friends ever get the invite, like it is never sent. I now believe the issue resides in Facebook.

    Does anyone know why Facebook would reply with a SUCCESS response and not actually send the invite to Friends? Could it be that the application being referenced in the invite is not actually in production (at Google Play) but only in beta? Does Facebook app invite only support Canvas apps and not Android or iOS apps?

    Any comments or suggestions is welcome.
    Thank you.

    using System;
    using Android.App;
    using Android.Content;
    using Android.Runtime;
    using Android.Views;
    using Android.Widget;
    using Android.OS;
    using Xamarin.Facebook;
    using Xamarin.Facebook.Share.Widget;
    using Xamarin.Facebook.Share.Model;
    namespace FacebookAppInviteTest {
        [Activity(Label = "FacebookAppInviteTest", MainLauncher = true, Icon = "@drawable/icon")]
        public class MainActivity : Activity {
            const String APP_LINK_URL = @""; // Not actual  value.
            const String PREVIEW_IMAGE_URL = @""; // Not actual  value.
            const String TAG = "FacebookAppInvite Test";
            int count = 1;
            ICallbackManager _callbackManager;
            Boolean _bIsCanShow;
            protected override void OnCreate(Bundle bundle) {
                // Set our view from the "main" layout resource
                _bIsCanShow = AppInviteDialog.CanShow();
                _callbackManager = CallbackManagerFactory.Create();
                Button btn = FindViewById<Button>(Resource.Id.MyButton);
                btn.Click += delegate {
                    btn.Text = string.Format("{0} clicks!", count++);
                    if (_bIsCanShow)
                        Android.Util.Log.Info(TAG, "Facebook is unavailable");
            protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) {
                base.OnActivityResult(requestCode, resultCode, data);
                _callbackManager.OnActivityResult(requestCode, (int)resultCode, data);
            void doAppInvite() {
                var aic = (AppInviteContent)new AppInviteContent.Builder()
                var appInviteDlg = new AppInviteDialog(this);
                appInviteDlg.RegisterCallback(_callbackManager, new CCallback());
            public class CCallback : Java.Lang.Object, IFacebookCallback {
                public void OnCancel() {
                public void OnError(FacebookException error) {
                    Android.Util.Log.Error(TAG, error.Message);
                public void OnSuccess(Java.Lang.Object result) {
                    Android.Util.Log.Info(TAG, "Success");
        } // class...
    } // namespace...
  • BradCrandallBradCrandall USMember ✭✭

    I have since learned that AppInviteDialog is not broken. It seems that app invites will only be received under the following conditions:

    1. Facebook friend must have an android device for my app to install on..
    2. Facebook friend doesn't already have my android application installed.
    3. Facebook friend is not blocking app invites from his/her Facebook page.
    4. Facebook App Invites expire after a unspecified time period (I think days).

    It seems all my Facebook friends either did not have an android device (e.g. they have iPhones) or already had the application installed. This is why they never received the app invites I have been sending.

  • AMAXAMAX USMember ✭✭

    Have you solve this issue?

Sign In or Register to comment.