ForegroundNotificationConfig constructor
- required String notificationTitle,
- required String notificationText,
- String notificationChannelName = 'Background Location',
- AndroidResource notificationIcon = const AndroidResource(name: 'ic_launcher', defType: 'mipmap'),
- bool enableWifiLock = false,
- bool enableWakeLock = false,
- bool setOngoing = false,
- Color? color,
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.
notificationChannelName
is the name of the notification channel as it is
displayed in the system settings.
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.
enableWakeLock
indicates wether or not a Wakelock is acquired, when the
background execution is started. If this is false then the system can
still sleep and all location events will be received at once when the
system wakes up again.
setOngoing
indicates wether or not the displayed notification is
persistent and the user cannot dismiss it.
color
is the accent color that is applied to the notificationIcon
.
Implementation
const ForegroundNotificationConfig({
required this.notificationTitle,
required this.notificationText,
this.notificationChannelName = 'Background Location',
this.notificationIcon =
const AndroidResource(name: 'ic_launcher', defType: 'mipmap'),
this.enableWifiLock = false,
this.enableWakeLock = false,
this.setOngoing = false,
this.color,
});