Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to use Xamarin.Auth with Monogame?

$
0
0

Hi everybody!

I use monogame for developing crossplatform game. For android I have one Activity:

[Activity (Label = "GameName", 
        MainLauncher = true,
        Icon = "@drawable/icon",
        Theme = "@style/Theme.Splash",
        AlwaysRetainTaskState = true,
        LaunchMode = Android.Content.PM.LaunchMode.SingleInstance,
        ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation |
        Android.Content.PM.ConfigChanges.KeyboardHidden |
        Android.Content.PM.ConfigChanges.Keyboard, 
        ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait)]
    public class Activity1 : AndroidGameActivity
    {
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);         
            Game1.Activity = this;
            var _game = new Game1 ();
            SetContentView (_game.Window);
            _game.Run ();
        }
        }

And I also would like to use Xamarin.Auth for Facebook integration. So, I'm doing next on onButtonTap:

var auth = new OAuth2Authenticator (
                clientId: "here_is_my_facebookApp_id",
                scope: "",
                authorizeUrl: new Uri ("https://m.facebook.com/dialog/oauth/"),
                redirectUrl: new Uri ("http://www.facebook.com/connect/login_success.html"));
auth.AllowCancel = true;
auth.Completed += (s, ee) => {
          // some code, does not matter what
                                         };
var intent = _auth.GetUI (activity);
activity.StartActivity (intent);

activity is my Activity1. As a result I have empty page after onButtonTap. I have used the same code in other android project (without monogame) and it works fine. But if I use it with monogame project then result is an empty page.

Can anybody help to make it work?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>