FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
130 stars 26 forks source link

Issue with Location Permission Handling #4808

Open hulum-io opened 2 weeks ago

hulum-io commented 2 weeks ago

Can we access your project?

Current Behavior

It correctly returns "True" for precise location permissions. It incorrectly returns "False" when approximate permissions are granted. If permission is denied, the page gets stuck in a loading state and does not update.

Expected Behavior

Return "True" for both precise and approximate permissions. Return "False" if permission is denied.

Steps to Reproduce

  1. Create a new page to request location permissions.
  2. Define an app state boolean variable.
  3. Add on page load action to request location permissions.
  4. Implement conditional logic to set the boolean variable based on the permission response.
  5. Display the value in a text field on the page.

Reproducible from Blank

Bug Report Code (Required)

ITESz/Hqx89gobQF+c+MKfpQhQIgQ0QnU7gnlO1ucx40B77nBLApOs7BaUNKTdPiewhYJla0kkQ0wcL1jezEUscEFwquGbpM0JVAegrMXkW6brq2CriWf3EmL91hC2680cKnriVRBMp2c3gF1Ga1N63qNleeY8aSfxBlZ7vfcPo=

Visual documentation

Screenshot 2024-11-02 at 9 42 50 PM

Environment

- FlutterFlow version: FlutterFlow v5.0.9 released October 25, 2024
- Platform: 
- Browser name and version:
- Operating system and version affected:

Additional Information

No response

Alezanello commented 2 weeks ago

Hello!

The boolean permission isn’t about "Approximate" or "Precise" but rather about states like "Granted," "Limited," "Denied," "Restricted," and "Permanently Denied."

Here’s a quick overview in code form:

const kPermissionStateToBool = {
  PermissionStatus.granted: true,
  PermissionStatus.limited: true,
  PermissionStatus.denied: false,
  PermissionStatus.restricted: false,
  PermissionStatus.permanentlyDenied: false,
};

You can review this in detail by downloading the custom code in /lib/flutter_flow/permissions_util.dart.

So, if the app is opened with the permission set to "Only this time," it’s classified as "Restricted" and therefore treated as false.

Hope this helps clarify!

hulum-io commented 2 weeks ago

I selected “approximate” and “while using this app” it returns the approximate LatLng value but the boolean return value is false. Is there any other way in flutterflow to check whether a permission is granted or not? If I select “approximate” and “Only this time” it returns true.

Screenshot_20241104_144451_Permission controller

hulum-io commented 2 weeks ago

Screenshot_20241104_144821

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

rzambroni commented 1 day ago

Hey @hulum-io,

Thank you for flagging this, and apologies for the delay in getting back to you! I’ve been able to confirm the issue you described and will forward it to the engineering team so they can take a closer look.

Appreciate your patience!

hulum-io commented 22 hours ago

hi @rzambroni, Distance calculation was one of the main functionalities of my app, and it worked perfectly before the October update. However, I had no choice but to remove this feature and move forward. I have already updated the privacy policy and information regarding location usage on both Google Play and the Apple App Store to reflect this change. I will reintegrate the feature in the future. Thank you for addressing the issue.