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
Describe the bug
iOS doesn't throw an Enxception when the permission on request is denied by user, while Android throws an Exception.
Expected behavior
When call a method location.getLocation() I expect that library react on user's action in case when user DENIED a location permission request. The same behavoir on Android currentlt exists - only iOS ignore this action.
Tested on:
iOS, Version 17.6 - IPhone 11 real device
Flutter v.3.24.0
location: ^7.0.0
Future<Coordinate> getLocation() async {
Location location =Location();
bool isServiceEnabled =false;
PermissionStatus permissionStatus =PermissionStatus.denied;
LocationData? locationData;
isServiceEnabled =await location.serviceEnabled();
if (!isServiceEnabled) {
isServiceEnabled =await location.requestService();
if (!isServiceEnabled) {
throwLocationServicesNotAvailable();
}
}
if (isServiceEnabled) {
try {
locationData =await location.getLocation();
} catch (_) {
// HERE we expect an Exception if user has denied the request <====// However iOS never reaches this line on code
permissionStatus =await location.hasPermission();
if (permissionStatus !=PermissionStatus.granted) {
throwLocationPermissionDenied();
} else {
rethrow;
}
}
}
returnCoordinate(latitude: locationData?.latitude ??0.0, longitude: locationData?.longitude ??0.0);
}
The text was updated successfully, but these errors were encountered:
Describe the bug
iOS doesn't throw an Enxception when the permission on request is denied by user, while Android throws an Exception.
Expected behavior
When call a method
location.getLocation()
I expect that library react on user's action in case when user DENIED a location permission request. The same behavoir on Android currentlt exists - only iOS ignore this action.Tested on:
The text was updated successfully, but these errors were encountered: