Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyLocation Click #792

Open
1 task
andrewD123 opened this issue Aug 29, 2022 · 1 comment
Open
1 task

MyLocation Click #792

andrewD123 opened this issue Aug 29, 2022 · 1 comment

Comments

@andrewD123
Copy link

VERSIONS

  • Xamarin.Forms.GoogleMaps - master
    .net Maui
    Android 12.

PLATFORMS

  • [ x] Android
  • [] iOS
  • UWP

ACTUAL BEHAVIOR

When clicking on the sample basic map clicking on my location I get
Java.Lang.SecurityException: 'my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION'

image

HOW TO REPRODUCE

run sample app on Android 12.

@amay077
Copy link
Owner

amay077 commented Aug 31, 2022

You should implement "Runtime Permission" for location.

Latest sample apps implements here:

switchMyLocationEnabled.Toggled += async (sender, e) =>
{
var status = await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
if (status != PermissionStatus.Granted)
{
await this.DisplayAlert("Permission Error", "This feature needs Location permission.", "CLOSE");
}
map.MyLocationEnabled = e.Value;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants