Flutter : Run an app as a background service

I want to show a custom popup message whenever the user disconnects a cellular call. The problem is how to detect when the app is not running. any leads would be helpful.


Solution 1:

It's been a while and there have been many developments.

First, there are some answers at How to create a service in Flutter to make an app to run always in background?

Also, flutter/Background processes will basically point you to medium/Executing Dart in the Background with Flutter Plugins and Geofencing (Sept 2018)

  • which is a Geofencing sample that involves a partnership between isolates, native Android/iOS code via MethodChannel, and PluginUtilities.getCallbackHandle (PluginUtilities)

Alas, there are many plugins available now:

  • https://pub.dev/packages/background_location
  • https://pub.dev/packages/android_alarm_manager (Android)
  • https://pub.dev/packages/background_fetch
  • https://pub.dev/packages/workmanager
  • https://pub.dev/packages/audio_service