Skip to content

Add Android live notification percentage/end handling#181

Open
Batman313v wants to merge 1 commit into
binwiederhier:mainfrom
Batman313v:live-notifications-android
Open

Add Android live notification percentage/end handling#181
Batman313v wants to merge 1 commit into
binwiederhier:mainfrom
Batman313v:live-notifications-android

Conversation

@Batman313v

Copy link
Copy Markdown

Add Live Notification Support (Percentage Chips & Countdown)

This PR adds support for promoted live notifications on Android API 34+, displaying progress percentage chips and countdown timers in the status bar using Android's Promoted Notification API. From PR 1752 on ntfy

What's New

  • Progress chips — percentage values (0%100%) shown as inline chips on the notification (100 renders as Done)
  • Countdown timersX-End timestamps render as a live chronometer countdown
  • Settings toggle — "Show live notifications" option in Settings (API 34+ only)
  • Promoted notifications — uses setRequestPromotedOngoing() for status bar chips on supported devices

Demo Video

Screen_Recording_20260523_210346_Nova.Launcher.mp4

Changes

File Description
db/Database.kt Migration 18→19: adds percentage (-1=unset) and end (0=unset) columns with duplicate-safe logic
db/Database.kt Room schema snapshot 19.json
msg/Message.kt Added percentage and end fields to message model
msg/NotificationParser.kt Parse percentage/end from incoming messages
msg/PromotedNotificationBuilder.kt New: builds promoted notification with chronometer + chip text
msg/NotificationService.kt Checks promoted path first, falls back to regular notification; applies parity click/delete/actions/sound
db/Repository.kt Live notification setting key + getter
ui/SettingsActivity.kt "Show live notifications" toggle (visible on API 34+)
res/values/values.xml Settings key constant
res/values/strings.xml Settings label + description strings
res/xml/main_preferences.xml Settings preference entry
AndroidManifest.xml POST_PROMOTED_NOTIFICATIONS permission (API 34+)
play/java/.../FirebaseService.kt Parse percentage/end from FCM data payload

Validation

  • Build: ./gradlew :app:assembleFdroidDebug — passes
  • Lint: ./gradlew :app:lintFdroidDebug — passes
  • Manual QA (all items passed per TESTING.md checklist as well as some others):
    • Subscribe to topic, send messages with tags/titles/priority
    • Main view: multi-delete, global mute toggle
    • Detail view: per-topic mute, instant toggle, clear notifications
    • New: Live countdown renders chronometer correctly
    • New: Percentage chips update in-place (0%, 50%, 100% → "Done")
    • New: Settings toggle hides/shows live notifications
    • New: Non-live notifications unchanged

Notes

Kotlin note: This is my first time working extensively with Kotlin, so the code may benefit from review by someone more experienced with the language and Android conventions. The core behavior works end-to-end as validated above, but I'd welcome any feedback.

  • Default percentage = -1 (unset) to distinguish absent from explicit zero
  • Default end = 0 (unset) — non-zero values trigger chronometer display
  • Promoted path is a pre-check; if conditions aren't met, falls back to regular notification
  • setRequestPromotedOngoing() used per Android API 34+ Promoted Notification spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant