/// /// declare module "cordova-background-geolocation-lt" { /** * __[Android only]__ The Android operating system requires a persistent notification when running a foreground service. * * ![](https://dl.dropbox.com/s/acuhy5cu4p7uofr/android-foreground-service-default.png?dl=1) * * @example * ```typescript * BackgroundGeolocation.ready({ * 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({ * 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](github:wiki/Android-Custom-Notification-Layout) for setup instructions. */ interface Notification { /** * When running the service with [[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. * * The following `notificationPriority` values defined as static constants upon the [[BackgroundGeolocation]] object: * * | Value | Description | * |---------------------------------------------------------|---------------------------------------------------------------------------------------------------------| * | [[BackgroundGeolocation.NOTIFICATION_PRIORITY_DEFAULT]] | Notification weighted to top of list; notification-bar icon weighted left | * | [[BackgroundGeolocation.NOTIFICATION_PRIORITY_HIGH]] | Notification **strongly** weighted to top of list; notification-bar icon **strongly** weighted to left | * | [[BackgroundGeolocation.NOTIFICATION_PRIORITY_LOW]] | Notification weighted to bottom of list; notification-bar icon weighted right | * | [[BackgroundGeolocation.NOTIFICATION_PRIORITY_MAX]] | Same as `NOTIFICATION_PRIORITY_HIGH` | * | [[BackgroundGeolocation.NOTIFICATION_PRIORITY_MIN]] | Notification **strongly** weighted to bottom of list; notification-bar icon **hidden** | * * @example * ```typescript * BackgroundGeolocation.ready({ * foregroundService: true, * notification: { * priority: BackgroundGeolocation.NOTIFICATION_PRIORITY_MIN * }); * ``` */ priority?: NotificationPriority; /** * Configure the Android Foreground Service icon and notification to be displayed __always__. Defaults to `false`. * * The default behaviour is for the notification to be shown only while the SDK detects the device to be *moving*. Some developers desire to provide full-disclosure to their users when the SDK has been enabled. */ sticky?: boolean; /** * Configure the *title* of the persistent notification in the Notification Bar when running with [[Config.foregroundService]] __`true`__ * @break * * Defaults to the application name from `AndroidManifest`. When running the service with [[foregroundService]]: true, Android requires a persistent notification. This will configure the **title** of that notification. */ title?: string; /** * Configure the *text* of the persistent notification in the Notification Bar when running with [[Config.foregroundService]] __`true`__ * @break * * Defaults to *"Location service activated"*. When running the service with [[Config.foregroundService]]: true, Android requires a persistent notification. This will configure the **text** of that notification. */ text?: string; /** * Configure the *color* of the persistent notification icon in the Notification Bar when running with [[Config.foregroundService]] __`true`__ * @break * * Defaults to `null`. When running the service with [[Config.foregroundService]]: true, Android requires a persistent notification. This will configure the **color** of the notification **icon** (API >= 21). * * Supported formats are: * - `#RRGGBB` * - `#AARRGGBB` */ color?: string; /** * Configure the *small icon* of the persistent notification in the Notification Bar when running with [[Config.foregroundService]] __`true`__ * @break * * When running the service with [[Config.foregroundService]]: true, Android requires a persistent notification in the Notification Bar. This allows you customize that icon. Defaults to your application icon. * * ### ⚠️ Warning: * - You must specify the **`type`** (`drawable|mipmap`) of resource you wish to use in the following format: `{type}/icon_name` * - Do not append the file-extension (eg: `.png`) * * @example * ```typescript * // 1. drawable * BackgroundGeolocation.ready({ * notification: { * smallIcon: "drawable/my_custom_notification_small_icon" * } * }); * * // 2. mipmap * BackgroundGeolocation.ready({ * notification: { * smallIcon: "mipmap/my_custom_notification_small_icon" * } * }); * ``` * * ### ℹ️ See also: * - [[largeIcon]] */ smallIcon?: string; /** * Configure the *large icon* of the persistent notification in the Notification Bar when running with [[Config.foregroundService]] __`true`__ * @break * * When running the service with [[Config.foregroundService]]: true, Android requires a persistent notification in the Notification Bar. This allows you customize that icon. Defaults to your application icon. * * ### ⚠️ Warning: * - You must specify the **`type`** (`drawable|mipmap`) of resource you wish to use in the following format: `{type}/icon_name` * - Do not append the file-extension (eg: `.png`) * * @example * ```typescript * // 1. drawable * BackgroundGeolocation.ready({ * notification: { * smallIcon: "drawable/my_custom_notification_small_icon" * }); * * // 2. mipmap * BackgroundGeolocation.ready({ * notification: { * smallIcon: "mipmap/my_custom_notification_small_icon" * } * }); * ``` * * ### ℹ️ See also: * - [[smallIcon]] */ largeIcon?: string; /** * Specifies the name of your custom Android Layout XML file. * ℹ️ See [Android Custom Notification Layout](github:wiki/Android-Custom-Notification-Layout) for setup instructions. ![](https://dl.dropbox.com/s/whcb6q1gxxdk9t1/android-foreground-notification-transistor.png?dl=1) Even if you have no experience with Android Layouts, it doesn't take much to figure out the basics. You'll mostly be adding ``, `` and `