Swayamshree Mohanty
Swayamshree Mohanty

Reputation: 378

How to run the flutter application in the background even after the application removed from the ram

I want to implement the feature (Example images were attached below) in the flutter application. I want that if I started a service, then it will not be killable till the service end. It will show a notification like this that the application service is still active. I want a service like this, the application continuously uploads the location of the user to my server in the background continuously. I tried the plugin work_manager. But this plugin runs the service every 15 minutes (15 minutes is the minimum time we can set).

Example of my requirements:

1. Here in my android task there is no application running.

enter image description here

2. But still, this application is running because the service was enabled.

enter image description here

Upvotes: 0

Views: 8202

Answers (1)

Sahil Sonawane
Sahil Sonawane

Reputation: 1396

Use flutter_background_services plugin. You can start a foreground service which will keep running even if the app is terminated. Here, you can set the interval as low as 1 second.

It is using STICKY service, which basically means, it will restart the service if terminated by the OS.

Upvotes: 2

Related Questions