flutter_foreground_service 0.4.0 copy "flutter_foreground_service: ^0.4.0" to clipboard
flutter_foreground_service: ^0.4.0 copied to clipboard

PlatformAndroid

Foreground service for the Android platform, keeps app running even when in background.

Flutter Foreground Service #

Setup #

Step 1 #

This plugin expects your application icon to be saved as ic_launcher.png which is the default name.

If you use the package flutter_launcher_icons to generate a new launcher icon, make sure to name the icon ic_launcher.png.

Step 2 #

Add the plugin to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  flutter_foreground_service: ^LATEST_VERSION_HERE

Replace the LATEST_VERSION_HERE the latest version number as stated on this page.

Step 3 #

Import the package into your project

import 'package:flutter_foreground_service/foreground_service.dart';

Usage #

Check out the example tab here on pub.dev to view the plugin in action.

In essence, the following line of code will start the foreground service:

await ForegroundService().start();

To stop the service again, use the following line of code:

await ForegroundService().stop();
30
likes
150
pub points
90%
popularity

Publisher

verified publishercachet.dk

Foreground service for the Android platform, keeps app running even when in background.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_foreground_service