Google Play Games

Hey guys,
For the past week or so I’ve been extremely, extremely stuck on getting Google Play leaderboards operational in my game. What I’m really having trouble with is signing into Google Play. The only way I’ve seen it done in Monogame is with a very old version of Google Play Services, using classes that don’t even exist in the current version. All I’ve come across so far is some Xamarin example code, which seems to run fine. However, that code makes use of a SignInButton, which, for whatever reason, I have not been able to run the code without. This SignInButton class, to my knowledge, can only be used in a Xamarin form/view/whatever (using an xml layout file), which I’m finding extremely difficult to integrate into my game, which, of course, doesn’t use this.

If anyone has any experience with getting Google Play Games working in recent versions of the GPS package, I’d love to hear how you went about it.

Thanks,
cros107

1 Like

There should be a NuGet Package from Xamarin providing the necessary bindings - but that’s just an idea, I haven’t used Play Services yet in Monogame or Xamarin

Yeah there is, but that’s exactly my problem- I have no idea how to integrate it with Monogame.

a quick google gave me this sample: https://github.com/xamarin/monodroid-samples/blob/master/google-services/SigninQuickstart/SigninQuickstart/MainActivity.cs

where it looks like the following is relevant:

var signInIntent = Auth.GoogleSignInApi.GetSignInIntent(mGoogleApiClient);
StartActivityForResult(signInIntent, RC_SIGN_IN);

not sure if that’s what you’re looking for - of course, this has to be in the android platform project. To call it from shared monogame, make a callback/delegate for it

I’m having a variety of issues with this, most notably that this stuff doesn’t work without a bunch of other code in that example, and that code requires the base class AppCompactActivity, while actually running a monogame game requires (at least it appears to require) AndroidGameActivity. I’m really not sure how to work around this, given that for whatever reason Xamarin code seems to be extremely reliant on the Activity1/MainActivity class.

Is there any alternative to Xamarin for Google Play Services stuff? Because this is honestly ridiculous, nothing Xamarin related makes any sense