How do you integrate the new Google login into the Xamarin.Android app?

I am trying to follow Google instructions on how to add a new Google account (and not an old Google+ signature) to my Xamarin.Android Application. In my life, I cannot find the right NuGet package for Google Play services or the Xamarin component that supports the new login system.

When I add the following code to the action, I get: "The type or namespace" GoogleSignInOptions "was not found. Are you missing an assembly reference?" Build error.

// Configure sign-in to request the user ID, email address, and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build(); 

Here are the Xamarin.GooglePlayServices NuGet packages that are included in the project:

 <package id="Xamarin.GooglePlayServices.Ads" version="27.0.0.0" targetFramework="MonoAndroid50" /> <package id="Xamarin.GooglePlayServices.Analytics" version="27.0.0.0" targetFramework="MonoAndroid50" /> <package id="Xamarin.GooglePlayServices.AppIndexing" version="27.0.0.0" targetFramework="MonoAndroid50" /> <package id="Xamarin.GooglePlayServices.Base" version="27.0.0.0" targetFramework="MonoAndroid50" /> <package id="Xamarin.GooglePlayServices.Basement" version="27.0.0.0" targetFramework="MonoAndroid50" /> <package id="Xamarin.GooglePlayServices.Identity" version="27.0.0.0" targetFramework="MonoAndroid50" /> <package id="Xamarin.GooglePlayServices.Location" version="27.0.0.0" targetFramework="MonoAndroid50" /> <package id="Xamarin.GooglePlayServices.Maps" version="27.0.0.0" targetFramework="MonoAndroid50" /> <package id="Xamarin.GooglePlayServices.Plus" version="27.0.0.0" targetFramework="MonoAndroid50" /> 

Is the new Google login system not yet supported on Xamarin or am I missing something?

+5
source share
1 answer

Enable pre-release versions of nugets and search:

 Xamarin.GooglePlayServices.Identity 29.0.0-beta1 

packages.config:

 <packages> <package id="Xamarin.Android.Support.v4" version="23.1.1.0" targetFramework="MonoAndroid44" /> <package id="Xamarin.GooglePlayServices.Auth" version="29.0.0-beta1" targetFramework="MonoAndroid44" /> <package id="Xamarin.GooglePlayServices.Base" version="29.0.0-beta1" targetFramework="MonoAndroid44" /> <package id="Xamarin.GooglePlayServices.Basement" version="29.0.0-beta1" targetFramework="MonoAndroid44" /> <package id="Xamarin.GooglePlayServices.Identity" version="29.0.0-beta1" targetFramework="MonoAndroid44" /> </packages> 

C # Version Integrate Google Login into your Android App

 SignInButton button = FindViewById<SignInButton> (Resource.Id.sign_in_button); gso = new GoogleSignInOptions.Builder (GoogleSignInOptions.DefaultSignIn) .RequestEmail () .Build (); mGoogleApiClient = new GoogleApiClient.Builder (this) .EnableAutoManage(mLoginFragment, failedHandler) .AddApi (Auth.GOOGLE_SIGN_IN_API) .Build (); button.Click += delegate { signIn(); }; 
+6
source

Source: https://habr.com/ru/post/1240016/


All Articles