Reputation: 2067
I am following this post to get user location in my UWP app but the following code always returns a Denied
status.
var accessStatus = await Geolocator.RequestAccessAsync();
I have already enabled "Location" capability in the app manifest, but still no permission dialog is showing up whatsoever.
What else have I missed?
Upvotes: 2
Views: 747
Reputation: 39006
You need to not only enable Location capability but also Location service in your Windows 10 settings.
To turn it on, go to Settings > Location Privacy Settings and then turn on the Location service toggle as shown in the picture below.
Note that when this system-wide Location service is on, even if the user denies your app from using his/her location, you can still get an imprecise location by enabling AllowFallbackToConsentlessPositions
from Geolocator
.
Upvotes: 5