Repository navigation
Backlog
Backlog
Pending-request notifications on Android: notification, tap opens the request, cancel when handled#1712
Feature
Copy link
Labels
Milestone
Description
Goal
On Android, a request that is waiting for the user while the app is in the background shows a system notification. Tapping it opens the app on the tab of the request. The notification disappears when the request ends or the app comes to the foreground.
Context
- Pending requests: native notification and Dock/taskbar attention while the app is in the background #1709 added the
PendingRequestNotifiertrait (a no-op on Android so far), the notification texts, the settings andactivate_pending_request(id). - Android host plugin
crates/tauri-plugin-android-host/:SessionService.kt: foreground-service notification on channelsessions(IMPORTANCE_LOW), content intent that opens the app.SessionServicePlugin.kt:43: requestsPOST_NOTIFICATIONSonce at the first session.AndroidManifest.xmldeclaresPOST_NOTIFICATIONS.- Strings are in
android/src/main/res/values/strings.xml(English only).
- Rust bridge:
crates/app-shell/src/android_service.rs(run_mobile_plugin), logic incrates/app-logic/src/background_keepalive.rs. - Frontend: a
visibilitychangelistener inapps/smart-ssh-community/frontend/src/hooks/useSessionTabs.ts:273-292resyncs pending state after returning from the background.
Requirements
- Android implementation of the notifier:
- "Background" means the main activity is not resumed.
- On
request_pendingin the background, with the notification setting on, post a notification on its own channel (suggested idpending_requests, IMPORTANCE_HIGH so it pops up), separate fromsessions. - The notification id is derived from the request id.
- Title and body come from the shared localized texts. The channel name is localized in the UI language as well.
- Tap: a content intent opens the main activity with the request id. It then calls
activate_pending_request(id), which switches to the tab. - Cancel the notification when its request ends, and all pending-request notifications when the activity resumes.
- Permission: if
POST_NOTIFICATIONSis not granted at the first pending request, request it once, the same way asSessionServicePlugindoes. If it is denied, log once and change nothing else. - No approve/deny actions in the notification. The attention setting stays hidden on Android.
Acceptance Criteria
- With the app in the background, an AI/MCP action that needs approval posts a notification on the
pending_requestschannel, with kind, server name and source only. - Tapping the notification opens the app on the tab of the request. A request without a tab only opens the app.
- The notification is cancelled when the request ends (approved, denied, timeout, tab closed) and when the app comes to the foreground.
- With the app in the foreground, no notification is posted.
- Notification setting off → no notification.
- Notification permission denied → no crash, logged once, request flow unchanged.
- The
sessionsforeground notification is unchanged. - Unit tests for the Rust side (id mapping, foreground/background decision, cancel on end) with a fake bridge.
- The Android build job passes.
- Relevant automated tests pass.
Technical Notes
- Real device behaviour (heads-up, lock screen, tap) can only be checked by hand. The reviewer lists manual test steps.
- Keep the Kotlin in its own class (e.g.
PendingRequestNotifications.kt) next toSessionService.kt. - No content in logs (Spec 0094).
Files: crates/tauri-plugin-android-host/android/src/main/java/dev/smartssh/androidhost/ (new class, plugin registration), crates/tauri-plugin-android-host/android/src/main/res/values/strings.xml, crates/tauri-plugin-android-host/src/, crates/app-shell/src/android_service.rs, crates/app-shell/src/ (android notifier module), docs/specs/ (pending-request notification spec)
Spec impact: update the pending-request notification spec created by #1709 (Android behaviour)
Open questions
- Use the existing android-host plugin with its own Kotlin class (recommended: one place for Android notifications, same intent handling as
SessionService), or the mobile API oftauri-plugin-notification(channels and cancel exist, but tap routing to a request id has to be checked).
Related Work
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
P2 - Normal
Activity