You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello, I'm running a flutter app on Windows 11 and keep encountering the error when calling Geolocation.checkPermission()
PlatformException (PlatformException(UNKNOWN_ERROR, RequestAccess failed. Check the Geolocation Service is running., null, null))
I have enabled Location Services on my local Windows 11 machine and allowed desktop apps to access my location. Is there some configuration I need to add to my flutter app or another Windows 11 setting I need to enable?
Here is my code for reference:
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
return Future.error('Location services are disabled.');
}
LocationPermission permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
return Future.error('Location permissions are denied');
}
}
if (permission == LocationPermission.deniedForever) {
return Future.error(
'Location permissions are permanently denied, we cannot request permissions.');
}
try {
Position position = await Geolocator.getCurrentPosition(
locationSettings: const LocationSettings(
accuracy: LocationAccuracy.bestForNavigation));
List<Placemark> placemarks =
await placemarkFromCoordinates(position.latitude, position.longitude);
// Process placemarks as needed
return placemarks.first.locality ?? 'Unknown location';
} catch (e) {
print('Error: $e');
throw Exception('Failed to get location');
}
Version
13.0.1
The text was updated successfully, but these errors were encountered:
Dripcoding
changed the title
[Question]:
[Question]: Windows 11 PlatformException when calling checkPermission method
Sep 28, 2024
Please check the following before submitting a new issue.
Please select for which platform(s) you need help
Your question
hello, I'm running a flutter app on Windows 11 and keep encountering the error when calling Geolocation.checkPermission()
I have enabled Location Services on my local Windows 11 machine and allowed desktop apps to access my location. Is there some configuration I need to add to my flutter app or another Windows 11 setting I need to enable?
Here is my code for reference:
Version
13.0.1
The text was updated successfully, but these errors were encountered: