I was building my Geolocation Xamarin App and recently found out upon trying to create a "mLocationRequest = new LocationRequest()" that LocationRequest() has been deprecated. Does anyone know how or what code to replace it with?
I was building my Geolocation Xamarin App and recently found out upon trying to create a "mLocationRequest = new LocationRequest()" that LocationRequest() has been deprecated. Does anyone know how or what code to replace it with?
Hi @StevenSquires-9060 , are you referring to class LocationRequest in Android? But according to the document, it hasn't been deprecated. You can also check the offical sample here: FusedLocationProvider/MainActivity.cs .
The attached png file shows what Visual Studio 2019 shows me when I create a "new LocationRequest()". I followed your link and studied the code. This is very puzzling.
Also, my browser does not locate my location. It somewhere in California.
Hello,
Welcome to our Microsoft Q&A platform!
Yes, the LocationRequest constructor is deprecated. You can use its static method:
So, you can change your code like this:
void CreateLocationRequest()
{
// mLocationRequest = new LocationRequest();
mLocationRequest = LocationRequest.Create();
mLocationRequest.SetInterval(UPDATE_INTERVAL);
mLocationRequest.SetFastestInterval(FASTEST_INTERVAL);
mLocationRequest.SetPriority(LocationRequest.PriorityHighAccuracy);
mLocationRequest.SetSmallestDisplacement(DISPLACEMENT);
locationClient = LocationServices.GetFusedLocationProviderClient(this);
}
Best Regards,
Jessie Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
I have one more question Jessie. My pixel emulator is still not starting in my current position. It does if I use my cell phone hardware, but it starts in California when I use the emulator. Any suggestions? Do I have a setting mis-configured?
Hi @StevenSquires-9060 ,one thread, one problem . For the new problem, you can create a new thread, we are all willing to help you. :)
Jessie,
I've run into another deprecated Xamarin/Google/Android Nuget. Do you know of a workaround for using the "PlaceAutoComplete.IntentBuilder" service in the Xamarin.GooglePlayServices.Places API?
Here's a code sample:
private void LayoutDestination_Click(object sender, EventArgs e)
{
Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.ModeOverlay)
.Build(this);
StartActivityForResult(intent, 2);
}
private void LayoutPickup_Click(object sender, EventArgs e)
{
Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.ModeOverlay)
.Build(this);
StartActivityForResult(intent, 1);
}
My Warning messages say, 'PlaceAutocomplete' is obsolete: 'This class is obsolete in this android platform'.
In my emulator, Google can't find the address entered.
![101868-placeautocomplete-deprecated.png][2]
7 people are following this question.