Show Notification
Summary
- Internal name:
ShowNotification - Category: Notifications
- Purpose: Display a system notification with a title and a message. Reuse the same notification ID to update or replace an existing notification.
- Task type: Normal
Compatibility
-
Minimum AndroMate version:
1.1.0 -
Maximum AndroMate version:
1.1.0 -
Minimum Android:
Android 13 (API 33) -
Maximum Android tested:
Android 16 (API 36) -
Required permissions:
POST_NOTIFICATIONS
Detailed description
The Show Notification task posts a notification to the system tray on a dedicated channel (andromate_workflow_notifications). The message is displayed with BigTextStyle, so long content is shown in full.
The task works from the background (foreground service) — notifications are designed for that. On Android 13+ (API 33), the POST_NOTIFICATIONS runtime permission must be granted; if it is not, the task throws NOTIFICATION-TASK-001.
Input parameters
| Parameter | Type | Required | Possible values / Rules | Android Compatibility | AndroMate Compatibility | Default |
|---|---|---|---|---|---|---|
title_text |
String | Yes | Notification title (supports interpolation) | Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | "" |
message |
String | Yes | Notification body (supports interpolation) | Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | "" |
notification_id |
Integer | No | Reuse the same ID to update/replace a notification | Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | 0 (auto) |
Output parameters
This task produces no output variable. It returns a VoidResult on success.
Exceptions
| Code | Trigger condition |
|---|---|
NOTIFICATION-TASK-001 |
POST_NOTIFICATIONS permission not granted (Android 13+) |
Execution flowchart
flowchart TD
Start([▶ ShowNotification]) --> Resolve[🔧 Resolve title & message]
Resolve --> Channel[📡 Ensure notification channel]
Channel --> Build[🔔 Build notification\nBigTextStyle]
Build --> Post{Permission granted ?}
Post -->|No| Throw([❌ NOTIFICATION-TASK-001])
Post -->|Yes| Notify[📬 NotificationManager.notify]
Notify --> Success([✅ VoidResult])
style Start fill:#e3f2fd
style Success fill:#c8e6c9
style Throw fill:#ffcdd2
style Build fill:#fff9c4
style Notify fill:#c8e6c9
How it works:
- Resolve:
title_textandmessageare resolved against the AndroMate context - Channel: the notification channel is created (idempotent)
- Build: a notification is built with
BigTextStyle - Post:
NotificationManager.notify(id, ...)— throwsNOTIFICATION-TASK-001if the permission is missing - Result: returns
VoidResult
Code examples
Example 1 — Notify when a workflow finishes
{
"ShowNotification": [
{
"id": "1",
"title": "Notify done",
"title_text": "Workflow finished",
"message": "Job $job_name completed successfully"
}
]
}
Example 2 — Update the same notification (fixed ID)
{
"ShowNotification": [
{
"id": "2",
"title": "Progress notification",
"title_text": "Progress",
"message": "Step 2 / 5 done",
"notification_id": 42
}
]
}
Input parameter details
title_text — Notification title
The bold title line of the notification. Supports $variable and ${SPECIAL_VAR} interpolation.
message — Notification body
The body text. Long messages are displayed in full thanks to BigTextStyle.
notification_id — Notification ID
Optional. If a positive value is given, the notification reuses that ID (a new call with the same ID updates/replaces the existing one). If left empty or 0, a unique ID is generated so each call shows a new notification.
Output parameter details
This task produces no output variable.