Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'PlusClass' is obsolete

When initializing GoogleApiClient, I get this warning:

'PlusClass' is obsolete: 'This class is obsoleted in this android platform'

What are 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" />
like image 808
Nilay Vishwakarma Avatar asked Jul 10 '26 23:07

Nilay Vishwakarma


1 Answers

I had the same problem and after a lot of digging around and reverse engineering java examples I arrived at the code below.

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" />
like image 128
Thomas Andersen Avatar answered Jul 13 '26 19:07

Thomas Andersen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!