mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

Requests GPS permission on load

Open landliebe opened this issue 1 year ago • 5 comments

Instantly asks for GPS permission when using Map, without further calling code to activate Puck. Tested on iOS Edit: After some tries to isolate the problem i found the trigger: .updateSettings(LocationComponentSettings(enabled: false) I guess this is not what should trigger a gps permission request from iOS.

Used 0.6.x before and there things worked as expected. Now updated to 2.1.0 and this behaviour started to show.

We want to have control over when gps permission is shown, as we want to be hyper nice to our users and give a lot of explanation why we need the permission beforehand and NOT just throw the iOS (with Plist reason string) dialog immediately at their faces on app start.

Environment: Flutter 3.22.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision b0850beeb2 (2 weeks ago) • 2024-07-16 21:43:41 -0700 Engine • revision 235db911ba Tools • Dart 3.4.4 • DevTools 2.34.3

landliebe avatar Aug 01 '24 09:08 landliebe

@landliebe Do you enable location indicator to be shown on the map right away? If so, location authorization is automatically requested on iOS.

evil159 avatar Aug 01 '24 10:08 evil159

Before posting here in issues i changed all occurences in code of LocationComponentSettings to: .updateSettings(LocationComponentSettings(enabled: false)

Just to be safe and not overseeing something

landliebe avatar Aug 01 '24 10:08 landliebe

Ok just finished some more testing and trying things: .updateSettings(LocationComponentSettings(enabled: false) Triggers the GPS permission request of iOS. I am pretty confident that this is not how this is supposed to go :)

landliebe avatar Aug 01 '24 10:08 landliebe

+1, same problem. There are no permissions calls anywhere in the code, set LocationComponentSettings.enabled false, but no result. When launching the application, the permissions request window pops up instantly.

stanislavlysenko0912 avatar Dec 18 '24 09:12 stanislavlysenko0912

I had the same error. I solved the issue avoiding call mapboxMap!.location.updateSettings on start. I call only after manage location permission by my own implementation. By default, the location is disabled on Mapbox.