Forum Libraries, Components, and Plugins

Xamarin Facebook Android SignIn ?

I am trying to get basic login with Xamarin Facebook working with Android. Here are my packages.

  <package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Facebook" version="" targetFramework="monoandroid60" />
  <package id="Xamarin.Facebook.Android" version="" targetFramework="monoandroid60" />
  <package id="Xamarin.Forms" version="" targetFramework="monoandroid60" />

I am following the tutorials here :

My biggest blocker is that the documentation is completely out of date. For instance, much of the work revolves around a 'Session' object which no longer exists. I tried refactoring the example to the new API, but nothing seems to work (init never completes, no exception). Here is some sample code.

  [Activity(Label = "")]
    public class FBActivitity : Activity
        public class FBInitCallback : FacebookSdk.IInitializeCallback
            public IntPtr Handle { get; }

            public FBActivitity Activity;

            public void OnInitialized()
                    new string[] {"public_profile", "email"});

            public void Dispose()

        protected async override void OnCreate(Bundle bundle)

            Xamarin.Facebook.FacebookSdk.SdkInitialize(this, new FBInitCallback {Activity = this});

I have tried rolling back to older version of the Facebook SDK but ran into errors due to circular resource dependencies.

Lastly, we did get something working using Xamarin.Auth and a WebView. We are unhappy with this working solution as it requires a user to sign in with a username and password without any help from cookies or autocomplete. For Facebook sign in to have value, we would need the native 'one click' sign on.

Sign In or Register to comment.