22
I’m using Xamarin to try to log in with facebook, I already generated the Hash and appid. ( Apparently correct, because previously the app returned me an msg saying that the HASH was invalid ). Follow the code of my Activity:
protected override void OnResume()
{
base.OnResume();
// Logs 'install' and 'app activate' App Events.
AppEventsLogger.ActivateApp(this);
}
/// <summary>
/// Register events logs of the facebook
/// </summary>
protected override void OnPause()
{
base.OnPause();
AppEventsLogger.DeactivateApp(this);
}
public override View OnCreateView(View parent, string name, Context context, IAttributeSet attrs)
{
return base.OnCreateView(parent, name, context, attrs);
}
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
FacebookSdk.SdkInitialize(this.ApplicationContext);
SetContentView(Resource.Layout.splash);
var callbackmanage = CallbackManagerFactory.Create();
LoginButton loginbutton = (LoginButton) base.FindViewById(Resource.Id.login_button);
var fcb = new facebookCallBack();
loginbutton.RegisterCallback(callbackmanage,fcb);
}
private class facebookCallBack : IFacebookCallback
{
public IntPtr Handle
{
get
{
return new IntPtr();
}
}
public void Dispose()
{
}
public void OnCancel()
{
}
public void OnError(FacebookException p0)
{
}
public void OnSuccess(Java.Lang.Object p0)
{
}
}
It turns out that now when I click the login button, nothing happens. It does not give any error message, nor does it enter callback methods ( OnError, OnPause etc), gives absolutely nothing.
That way, I’m lost. Anyone can help?
You didn’t put anything in the methods that
implementam IFacebookCallbackhow will you capture the return? See this example: https://gist.github.com/rmenezes/d1a98e18f19c6555c6c2– rubStackOverflow
Thanks for the return. But I had put in the debug, breakpoint in all methods I implemented from Ifacebookcallback. None of them paused. I’ll check the example!
– Paulo