Flutter Application : Location fetch in background

7.4k views Asked by At

I want to keep my application running or a piece of code which can perform some operation like getting a current location and call an API to submit that location.

I saw the background_fetch plugin but it says, app can not fetch the callback before 15 minutes in background so it is not feasible solution for tracking a location to get location every 15 minutes, so is there any way that can make possible to keep running some code in background.

Any leads would be appreciated.

Thanks

2

There are 2 answers

1
Code Runner On

Now officially there is some plugins for background location tracking. check out below links:

  1. background_Locations
  2. background_location
2
Mangaldeep Pannu On

In flutter, code can be executed in background using Isolates

Isolates are Dart’s model for multithreading, though an isolate differs from a conventional thread in that it doesn’t share a memory with the main program.

Check this post for more info.