8.4 C
Canberra
Tuesday, August 19, 2025

android – Points with exhibiting pop up for location permission in iOS


In my Flutter undertaking, I’m utilizing a lib permission_handler for permissions.

I’m going through points with exhibiting popup dialogue whereas requesting permission for location. My code is as follows:

Future _requestLocationPermission() async {
    // Examine if location companies are enabled
    bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
    if (!serviceEnabled) {
      // Location companies should not 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 below 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 right 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 many others.. are working wonderful.

After doing this it begins opening popup for location permission.

However the query is why it isn’t required to switch the Podfile for different permissions like storage and notification and many others 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 one more 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 isn’t uniform for each, Android and iOS?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles