foreground_notification 0.2.0 copy "foreground_notification: ^0.2.0" to clipboard
foreground_notification: ^0.2.0 copied to clipboard

A flutter plugin for customizing "forground service" notification with chronometer. (iOS is not supported)

Foreground Service Notification Plugin #

Migrate to AndroidX

A Flutter plugin to show forground service notification and customize it. (iOS is not supported)

If you need present that your app is running as a service in user's phone, you can use this plugin.

Usage #

To use this plugin, add foreground_service_notification as a dependency in your pubspec.yaml file.

Example (see file in example/lib/main.dart) #

    // Import package
    import 'package:foreground_notification/foreground_notification.dart';

    // Instantiate it
    ForegroundNotification foregroundNotification;
    foregroundNotification = ForegroundNotification();
    ForegroundNotification().initialize(
      selectNotification: null,
      // input your notification title
      title: 'Flutter Notification Title',
      // input your notification message body
      message: 'Flutter Message Body',
      // if you need chronometer, set value true (* chronometer is an extremely accurate clock)
      useChronometer: false,
      // if you set chronometer true, set the time you want to start
      when: DateTime.now().millisecondsSinceEpoch,
    );

    /// show notification
    foregroundNotification.showAOSNotification();

    /// close notification
    foregroundNotification.closeAOSNotification();

When you set the useChronometer true and set the start time, the seconds start to move from the time you set. if you do not set the start time(when field), it is initialized to current time.

** If you want to show this notification, you first set up your app icon image in folder your_app/android/app/src/main/res/drawable/app_icon.png Image must be named 'app_icon.png'**

  • Chronometer
  • Small Icon
  • Large Icon
1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A flutter plugin for customizing "forground service" notification with chronometer. (iOS is not supported)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on foreground_notification