transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
650 stars 241 forks source link

Package show modal "Background locations is not enabled" when i call `bg.BackgroundGeolocation.getCurrentPosition` #1353

Closed KlipX closed 1 month ago

KlipX commented 2 months ago

Your Environment

Expected Behavior

I can read current user location when app is in foreground without 'Background location is not enabled' modal/popup

Actual Behavior

When I try to read a single user's current location while the app is in foreground , the app displays the modal/popup “Background location is not enabled”.

image

Steps to Reproduce

  1. call await bg.BackgroundGeolocation.ready with provided above config
  2. call await bg.BackgroundGeolocation.getCurrentPosition() with provided above config
  3. only on iOS you can see modal image

Context

image 1:

image

image 2:

image

In my app I have a function where I track the user in the background and it works fine. But now in another scenario I need to read only the current position of the user and when I call bg.BackgroundGeolocation.getCurrentPosition() on iOS the modal “image 2” appears. The modal only appears on iOS. I think this is incorrect behavior, because when we call getCurrentPosition, we do not need background tracking permissions. I think it should be required only when we call bg.BackgroundGeolocation.start (). Is there any way to disable this modal when we call getCurrentPosition and show only for bg.BackgroundGeolocation.start (). Of course, the modal asking for permission (image 1) should be visible in both cases.

Debug logs

Logs ``` PASTE_YOUR_LOGS_HERE ```
christocracy commented 2 months ago

See API docs Config.locationAuthorizationRequest (the default is Always). There is a lot of information there about this.

KlipX commented 1 month ago

its help thanks