foreground_notification 0.2.0

Flutter Android iOS

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'**

  • [x] Chronometer
  • [x] Small Icon
  • [ ] Large Icon
0
likes
80
pub points
56%
popularity

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

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

songyi0207@gmail.com

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on foreground_notification