Skip to main content

ForegroundNotificationConfiguration

Android foreground-service notification settings for background tracking.

Supply this configuration through GeolocatorAndroidConfiguration.foreground_notification_config to control the persistent notification shown while background location updates are active.

Properties

Properties​

notification_channel_nameclass-attributeinstance-attribute​

notification_channel_name: str = 'Background Location'

The user visible name of the notification channel.

The notification channel name will be displayed in the system settings. The maximum recommended length is 40 characters, the name might be truncated if it is to long. Default value: "Background Location".

notification_enable_wake_lockclass-attributeinstance-attribute​

notification_enable_wake_lock: bool = False

When enabled, a Wakelock is acquired when 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.

Wake lock permissions should be obtained first by using a permissions library.

notification_enable_wifi_lockclass-attributeinstance-attribute​

notification_enable_wifi_lock: bool = False

When enabled, a WifiLock is acquired when 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 (e.g. for background network communications).

Wifi lock permissions should be obtained first by using a permissions library.

notification_set_ongoingclass-attributeinstance-attribute​

notification_set_ongoing: bool = False

When enabled, the displayed notification is persistent and the user cannot dismiss it.

notification_textinstance-attribute​

notification_text: str

The body used for the foreground service notification.

notification_titleinstance-attribute​

notification_title: str

The title used for the foreground service notification.