Forum Xamarin.Forms

PopUp Location

I am trying to implement the google popup for the location but unfortunately the method I found has been deprecated. More precisely googleapiclient and locationservices are deprecated
I can't figure out how to update it. Below is the code

public async void turnOnGPS()
                MainActivity activity = Forms.Context as MainActivity;

                GoogleApiClient googleApiClient = new GoogleApiClient.Builder(activity)
                LocationRequest locationRequest = LocationRequest.Create();
                locationRequest.SetFastestInterval(10000 / 2);

                        locationSettingsRequestBuilder = new LocationSettingsRequest.Builder()
                LocationSettingsResult locationSettingsResult = await LocationServices.SettingsApi.CheckLocationSettingsAsync(
                    googleApiClient, locationSettingsRequestBuilder.Build());

                if (locationSettingsResult.Status.StatusCode == LocationSettingsStatusCodes.ResolutionRequired)
                    locationSettingsResult.Status.StartResolutionForResult(activity, 0);
            catch (Exception)



  • YelinzhYelinzh Member, Xamarin Team Xamurai

    More precisely googleapiclient and locationservices are deprecated

    The LocationServices api seems not be deprecated. Do you mean the SettingsApi? If so, try using SettingsClient instead. The SettingsClient class also provide the
    checkLocationSettings method.

     Task<LocationSettingsResponse> result =

    Check the doc:

    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

  • DavidSpecterDavidSpecter Member ✭✭
    edited February 22

    I'm working on API 29 and this is the alert of Visual Studio.


  • YelinzhYelinzh Member, Xamarin Team Xamurai

    As the screenshot shows, the SettingsApi is obsoleted. You could use the SettingsClient class instead.

    The LocationServices.getSettingsClient(this).checkLocationSettings method doesn't requires a GoogleApiClient parameter.

Sign In or Register to comment.