How to run background tasks when App Closed?

I want to run task in background to trigger notifications, or schedule task using alarm manager for file handling.
How can i do that with flutter WITHOUT flutter_background_service: ^5.0.10,
I don’t need code
just reference or idea how it will work in Android and iOS

You will be disappointed.

Disclaimer: I have an app that requires notifications to be displayed at a given time, chosen by the user (it’s a reminder). 10 million downloads. The most complaint about the app is “the app is not notifying me”.

Why?

Notice that Flutter and Dart do NOTHING except UI. All other stuff is made in native code (i.e.: flutter_background_service will use native code to create a background service or a background job).

On Android, you can have a pinned notification that ensures your app is running in the background (at least once every 15 or 30 minutes, depending on the OEM). But some OEM disables the load on boot option, so, if the user restarts the device, your service is lost until the user opens your app.

2 Likes

I was also trying to build a similar thing(reminder based on user inputs. can even be per 30 minutes) we could not. not because of flutter but ios restrictions and some android devices. we ended up moving the implementation to the backend using agenda and it worked perfectly. Agenda is very good when it comes to these kinda things

1 Like

You remind me something:

There is a package for Flutter that deals with the native calendar apps from both Android and iOS.

Since those apps are considered important, they often work better with notifications.

So, you could create a new agenda in the phone’s calendar apps and put your events there.

1 Like