FlutterBackgroundAndroidConfig constructor

const FlutterBackgroundAndroidConfig({
  1. String notificationTitle = 'Notification title',
  2. String notificationText = 'Notification text',
  3. AndroidNotificationImportance notificationImportance = AndroidNotificationImportance.Default,
  4. AndroidResource notificationIcon = const AndroidResource(name: 'ic_launcher', defType: 'mipmap'),
  5. bool enableWifiLock = true,
  6. bool showBadge = true,
  7. bool shouldRequestBatteryOptimizationsOff = true,
})

Creates an Android specific configuration for the FlutterBackground plugin.

notificationTitle is the title used for the foreground service notification. notificationText is the body used for the foreground service notification. notificationImportance is the importance of the foreground service notification. notificationIcon must be a drawable resource. E. g. if the icon with name "background_icon" is in the "drawable" resource folder, it should be of value `AndroidResource(name: 'background_icon', defType: 'drawable'). enableWifiLock indicates wether or not a WifiLock is acquired, when the background execution is started. This allows the application to keep the Wi-Fi radio awake, even when the user has not used the device in a while. showBadge indicates whether the notification badge should be shown/incremented or not. shouldRequestBatteryOptimizationsOff indicates whether or not to request permission to disable battery optimizations. This is enabled by default, and should only be disabled on platforms that do not support it (ex: Wear OS).

Implementation

const FlutterBackgroundAndroidConfig({
  this.notificationTitle = 'Notification title',
  this.notificationText = 'Notification text',
  this.notificationImportance = AndroidNotificationImportance.Default,
  this.notificationIcon =
      const AndroidResource(name: 'ic_launcher', defType: 'mipmap'),
  this.enableWifiLock = true,
  this.showBadge = true,
  this.shouldRequestBatteryOptimizationsOff = true,
});