How to create a service in Flutter to make an app to run always in background?

There isn’t a way to do this directly from flutter right now although that may change at some point – see this bug/feature request. You do have a couple of options though.

The first is to use MethodChannels and simply write the android code you want to create a background service (or if you want it to always be a background service you can probably do that without needing communication from the flutter side).

The second is some combination of these two plugins – android_alarm_manager and android_intent. But that won’t help for all use-cases.

EDIT Feb 2021:

Flutter now supports running background processes. See this page for details.

Leave a Comment