Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No tracking when in background #71

Open
remoteportal opened this issue Nov 27, 2023 · 6 comments
Open

No tracking when in background #71

remoteportal opened this issue Nov 27, 2023 · 6 comments

Comments

@remoteportal
Copy link

remoteportal commented Nov 27, 2023

I see that if the example app is not in the foreground (the background), I continue to get notifications.

But as I close the app the notifications stop.

@ikbendewilliam
Copy link
Contributor

You need to set the location permission to "always allow". This is not something an app can request and in a production app you should show a dialog to the user and open settings for them.

@ikbendewilliam ikbendewilliam changed the title What does "background No tracking when in background Mar 28, 2024
@zwells
Copy link

zwells commented Apr 4, 2024

After setting "always allow", does this plugin work on iOS when the app is terminated? i.e. when the 500 meter threshold is passed, does it wake up the app with our callback?

Reference: https://developer.apple.com/documentation/corelocation/cllocationmanager/1423531-startmonitoringsignificantlocati

@12people
Copy link

@ikbendewilliam Even with that setting enabled, it doesn't work for me.

To reproduce:

  1. Install the example app on an iOS emulator (I use iOS 17.4 on iPhone SE 3rd gen, but I assume any modern emulator will do)
  2. In the emulator's Features > Location menu, choose Freeway Ride
  3. Enable the "always" location setting in iOS Settings
  4. Open the example app
  5. Start tracking location
  6. Open the iOS app overview
  7. Swipe the example app away

Expected result:

  • Location notifications will continue showing up indefinitely, location will continue to be tracked
  • The location indicator will continue to appear in the system tray

Actual result:

  • Only around 5 notifications appear after the app's closing (likely leftovers from before the app was closed)
  • The location indicator disappears from the system tray as soon as the app is closed

@zwells
Copy link

zwells commented Apr 15, 2024

I made a pull request on a different repo that achieves this: Almoullim/background_location#207

@12people
Copy link

There's also flutter_location_wakeup that seems to do this.

Would be good to have it in one add-on, though. And perhaps there's even a better way to achieve this in general?

The perfect solution for my use case would be a native geofencing plug-in that works reliably in the background.

@wahabsohail
Copy link

background_location_tracker: ^1.4.4

I'm using this version, but location tracking stops in the background. I also tested the example application, and I have the same issue. Can someone guide me, please? I need to implement live tracking in my application.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants