In my Flutter mission, I’m utilizing a lib permission_handler for permissions.
I’m dealing with points with exhibiting popup dialogue whereas requesting permission for location. My code is as follows:
Future _requestLocationPermission() async {
// Examine if location providers are enabled
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
// Location providers aren't enabled
return;
}
PermissionStatus standing = await Permission.location.request();
// Step 2: Examine permission standing
//PermissionStatus standing = await Permission.location.standing;
if (standing.isGranted) {
print("Permission granted");
_getCurrentLocation();
} else if (standing.isDenied) {
print("Permission denied");
} else if (standing.isPermanentlyDenied) {
print("Permission Completely denied");
}
}
And because it was urged as prerequisite like, some traces must be included in data.plist file that are as:
NSLocationWhenInUseUsageDescription
This app wants location entry whereas utilizing the app.
NSLocationAlwaysUsageDescription
This app wants location entry always.
NSLocationAlwaysAndWhenInUseUsageDescription
This app wants location entry all the time and when in use.
UIBackgroundModes
location
And in xcode, Runner -> signing and capabilities -> I checked Location Updates underneath Background Modes
After doing these above issues, I used to be unable to open permission popup for location.
I analysis and bought an answer on stack overflow at https://stackoverflow.com/a/68600411/5034193
which tells that, Permissions on iOS are disabled by default, and you’ve got the set the proper GCC_PREPROCESSOR_DEFINITIONS in you Podfile.
It urged traces for nearly all permissions however I picked solely the road for location which was ‘PERMISSION_LOCATION=1’, and didn’t write for different permissions. As a result of different permissions like permission for storage, notification and so on.. are working nice.
After doing this it begins opening popup for location permission.
However the query is why it’s not required to switch the Podfile for different permissions like storage and notification and so on however Location.
Does It require any settings in apple developer app retailer join or any the place to keep away from modifying the Podfile?
And yet another doubt, apart from this as:
when it opens dialogue and on Do not permit
it goes into standing.isPermanentlyDenied
however within the case of Android It goes into standing.isDenied
Why it’s not uniform for each, Android and iOS?