Search code examples
iosflutterbackgroundlocation

ios - background location getting and sending periodically, silent push (Flutter)


The goal is to get iPhone location and send it to the server periodically (like every 15 minutes, the interval is a parameter), when the app is on the screen, or in background. The server expects the phone location at given intervals even if the location did not change. We are using Flutter. The app is for iOS and Android. We have tried some libraries like background_fetch, but they seem not to guarantee the exact intervals. We are experimenting with silent push notifications but they do not work always, especially when the app is in background. Can anyone point me to the right direction please?


Solution

  • For getting location updates when the app is active, in background or killed

    I have used this package (background_locator) and it works as expected, you could also specify your own intervals as to when you want to receive the location updates (in your case 15 minutes)

    You can check the example folder and documentation on the usage of the package

    background_locator