"PlusClass" is deprecated

I get the following warning when initializing the GoogleApiClient:

"PlusClass" is deprecated: "This class is deprecated in this android platform

What is its alternative?

code:

mGoogleApiClient = new GoogleApiClient.Builder(this)
   .AddConnectionCallbacks(this)
   .AddOnConnectionFailedListener(this)
   .AddApi(PlusClass.API)
   .AddScope(new Scope(Scopes.Profile))
   .Build();

      

Version:

  <package id="Xamarin.GooglePlayServices.Base" version="42.1001.0" targetFramework="monoandroid71" />
  <package id="Xamarin.GooglePlayServices.Basement" version="42.1001.0" targetFramework="monoandroid71" />
  <package id="Xamarin.GooglePlayServices.Plus" version="42.1001.0" targetFramework="monoandroid71" />
  <package id="Xamarin.GooglePlayServices.Tasks" version="42.1001.0" targetFramework="monoandroid71" />

      

+3


source to share


1 answer


I had the same problem and after doing a lot of searching and reverse engineering the java examples I ended up with the below code.

protected override void OnCreate(Bundle bundle)
{
    base.OnCreate(bundle);

    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn)
        .RequestProfile()
        .Build();

    _GoogleApiClient = new GoogleApiClient.Builder(this)
        .AddConnectionCallbacks(this)
        .AddOnConnectionFailedListener(this)
        .AddApi(Auth.GOOGLE_SIGN_IN_API, gso)
        .Build();
}

      



Packages

<package id="Xamarin.GooglePlayServices.Auth" version="42.1001.0" targetFramework="monoandroid71" />
<package id="Xamarin.GooglePlayServices.Auth.Base" version="42.1001.0" targetFramework="monoandroid71" />
<package id="Xamarin.GooglePlayServices.Base" version="42.1001.0" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Basement" version="42.1001.0" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Location" version="42.1001.0" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Plus" version="42.1001.0" targetFramework="monoandroid71" />
<package id="Xamarin.GooglePlayServices.Tasks" version="42.1001.0" targetFramework="monoandroid70" />

      

+3


source







All Articles