Notification class

(Android only) The Android operating system requires a persistent notification when running a foreground service.

Example

BackgroundGeolocation.ready(Config(
  notification: Notification(
    title: "The Title",
    text: "The Text"
  )
))
.
.
.
// To update the notification in real-time, use #setConfig
// You need only provide *changed* parameters --  initially configured
// parameters will remain unchanged.
BackgroundGeolocation.setConfig(Config(
  notification: Notification(
    title: "The New Title"
  )
))

Custom Notification Layouts

Use the layout option to provide the name of your own Android Layout XML File. See Android Custom Notification Layout for setup instructions.

Constructors

Notification({String? layout, String? title, String? text, String? color, String? channelName, String? channelId, String? smallIcon, String? largeIcon, int? priority, bool? sticky, Map<String, String>? strings, List<String>? actions})

Properties

actions List<String>?
Declare click listeners for <Button /> elements of a custom notification layout.
getter/setter pair
channelId String?
Customize the notification channel ID. Defaults to your.package.name.TSLocationManager
getter/setter pair
channelName String?
Configure the name of the plugin's notification-channel used to display the Config.foregroundService notification.
getter/setter pair
color String?
Configure the color of the persistent notification icon in the Notification Bar when running with Config.foregroundService true
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
largeIcon String?
Configure the large icon of the persistent notification in the Notification Bar when running with Config.foregroundService true
getter/setter pair
layout String?
Specifies the name of your custom Android Layout XML file.
getter/setter pair
priority int?
When running the service with Config.foregroundService: true, Android requires a persistent notification in the Notification Bar. This will control the priority of that notification as well as the position of the notificaiton-bar icon.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
smallIcon String?
Configure the small icon of the persistent notification in the Notification Bar when running with Config.foregroundService true
getter/setter pair
sticky bool?
Configure the Android Foreground Service icon and notification to be displayed always. Defaults to false.
getter/setter pair
strings Map<String, String>?
Custom strings to render into <TextView /> elements of a custom notification layout.
getter/setter pair
text String?
Configure the text of the persistent notification in the Notification Bar when running with Config.foregroundService true
getter/setter pair
title String?
Configure the title of the persistent notification in the Notification Bar when running with Config.foregroundService true
getter/setter pair

Methods

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

Operators

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

Static Methods

fromMap(Map map) → dynamic
Convert supplied Map to Notification instance.