I'm using the Xamarin.Facebook.Android package for this. The dialog displays correctly and the requests go through to the correct recipients but the callbacks never get called. I'm not 100% sure where I'm supposed to get the CallbackManager from.
I've been stuck on this issue for about a week now. It's holding up a release of our app.
I'd greatly appreciate any help.
`
public class FacebookService : IFacebookService
{
public void InviteFriends(FacebookInviteCallbacks facebookInviteCallbacks)
{
if (AppInviteDialog.CanShow())
{
var activity = Xamarin.Forms.Forms.Context as Activity;
var content = new GameRequestContent.Builder().
SetTitle("Check out this game").
SetMessage("Check out this game I play!").
Build() as GameRequestContent;
var dialog = new GameRequestDialog(activity);
dialog.RegisterCallback(CallbackManagerFactory.Create(), new MyFacebookCallback(facebookInviteCallbacks));
dialog.Show(content);
}
}
}
public class MyFacebookCallback : Java.Lang.Object, IFacebookCallback
{
private FacebookInviteCallbacks facebookInviteCallbacks;
public ImcFacebookCallback(FacebookInviteCallbacks facebookInviteCallbacks)
{
this.facebookInviteCallbacks = facebookInviteCallbacks;
}
public void OnCancel()
{
System.Diagnostics.Debug.WriteLine("Cancelled sending invite");
}
public void OnError(FacebookException error)
{
facebookInviteCallbacks.FailedCallback(error.Message);
}
public void OnSuccess(Java.Lang.Object result)
{
System.Diagnostics.Debug.WriteLine(result);
}
}`