4

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

Code Runner
  • 868
  • 16
  • 27

2 Answers2

2

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.

Mangaldeep Pannu
  • 3,738
  • 2
  • 26
  • 45
  • Sure, I will give it a try. Thanks – Code Runner Nov 25 '19 at 16:51
  • is there any restriction for android like we can just run call backs every 15 minutes as the background_fetch plugin says? Your answer seems correct but if there is restrictions like that then it does not worth it. – Code Runner Nov 28 '19 at 14:16
0

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

  1. background_Locations
  2. background_location
Code Runner
  • 868
  • 16
  • 27
  • This does not worked for me because it was crashing my application so probably it is in development so it might be buggy.so i just submitted an issue for that plugin – Code Runner Nov 25 '19 at 16:51