Deekshith Xetty
Deekshith Xetty

Reputation: 337

How to keep flutter app running in the background when screen is locked

I want my app to keep running in the background to send the user location to the firebase. I'm using background_locator plugin for this purpose. But the problem is that when the phone is locked the app runs fine in the background for few minutes (30 mins approx in high end devices & 4-5 hrs approx on older android devices) and stops. And when i turn ON the screen the app starts to run again. until then the app will be paused after running for few minutes from the time when the phone is locked.

Upvotes: 1

Views: 1465

Answers (1)

Biruk Telelew
Biruk Telelew

Reputation: 1193

try the following flutter package (android only)

background_mode: ^1.0.1

and in your main page init state method call this

BackgroundMode.start();

Upvotes: 1

Related Questions