I want to implement something like this in my Android application that I'm developing in Xamarin but can not find a namespace in which the GoogleApiClient
is. Can anybody help?
Yeah GoogleApiClient has been deprecated. Particularly for the authentication api, you now need to use GoogleSignInClient .
You can use the GoogleApiClient ("Google API Client") object to access the Google APIs provided in the Google Play services library (such as Google Sign-In, Games, and Drive).
Xamarin. Essentials provides a single cross-platform API that works with any iOS, Android, or UWP application that can be accessed from shared code no matter how the user interface is created. See the platform & feature support guide for more information on supported operating systems.
GoogleApiClient
is in the Android.Gms.Common.Apis
namespace.
That namespace is in the "Xamarin.GooglePlayServices.Basement" assembly, but you do not install that directly.
So, assuming you are trying to access that in doing some Android Location/Map development, install this nuget:
Xamarin Google Play Services - Location
Xamarin.Android Bindings for Google Play Services - Location
One of the unique features of mobile applications is location awareness. Mobile users take their devices with them everywhere, and adding location awareness to your app offers users a more contextual experience. The location APIs available in Google Play services facilitate adding location awareness to your app with automated location tracking, geofencing, and activity recognition.
To install Xamarin Google Play Services - Location, run the following command in the Package Manager Console
PM> Install-Package Xamarin.GooglePlayServices.Location
Using clause:
using Android.Gms.Common.Apis;
Code:
var foo = GoogleApiClient ();
In addition to RobertN answer, it seems there were some naming/namespace changes in 27.0.0.0.
So here's an example that might help:
GoogleApiClient api = new GoogleApiClient.Builder (Application.Context, this, this)
.AddApi (Android.Gms.Location.LocationServices.API)
.Build ();
In the above code this means that the below interfaces are implemented:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With