ForegroundServiceConfig class

Configuration for the Android foreground service notification.

The foreground service is required on Android for reliable background location access. Set enabled to false to disable it for scenarios where only one-shot location requests are needed and continuous background tracking is not required.

Warning: Disabling the foreground service means the OS may kill the app at any time when it is in the background. Only disable this when you do not need persistent background tracking.

Annotations

Constructors

ForegroundServiceConfig({bool enabled = true, String channelId = 'tracelet_channel', String channelName = 'Tracelet', String notificationTitle = 'Tracelet', String notificationText = 'Tracking location in background', String? notificationColor, String? notificationSmallIcon, String? notificationLargeIcon, int notificationPriority = 0, bool notificationOngoing = true, List<String> actions = const <String>[]})
Creates a new ForegroundServiceConfig.
const
ForegroundServiceConfig.fromMap(Map<String, Object?> map)
Creates a ForegroundServiceConfig from a map.
factory

Properties

actions List<String>
Action button labels shown on the notification.
final
channelId String
The Android notification channel ID.
final
channelName String
The Android notification channel name.
final
enabled bool
Whether the Android foreground service is enabled.
final
hashCode int
The hash code for this object.
no setteroverride
notificationColor String?
ARGB color of the notification (e.g. '#FF0000').
final
notificationLargeIcon String?
Resource name of the large icon.
final
notificationOngoing bool
Whether the notification is ongoing (cannot be swiped away). Defaults to true.
final
notificationPriority int
Notification priority (-2 to 2). Defaults to 0.
final
notificationSmallIcon String?
Resource name of the small icon (e.g. 'drawable/ic_notification').
final
notificationText String
Body text of the foreground notification.
final
notificationTitle String
Title text of the foreground notification.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, Object?>
Serializes to a map.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override