fix: restore foreground notification after user swipe on Android 13+#527
Merged
torlando-tech merged 1 commit intomainfrom Feb 22, 2026
Merged
fix: restore foreground notification after user swipe on Android 13+#527torlando-tech merged 1 commit intomainfrom
torlando-tech merged 1 commit intomainfrom
Conversation
On Android 13+ (API 33), users can swipe away foreground service notifications. Once dismissed, NotificationManager.notify() cannot restore them — only Service.startForeground() can. Route all notification updates through startForeground() instead of notify(), and reinforce the notification on Activity resume so it reappears when the user reopens the app. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Greptile SummaryAddresses Android 13+ behavior where foreground notifications can be dismissed by user swipe. Routes all notification updates through Key Changes:
Implementation Quality:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant MainActivity
participant ReticulumService
participant NotificationMgr as ServiceNotificationManager
participant Android
Note over User,Android: User swipes away notification (Android 13+)
User->>Android: Swipe notification
Android-->>NotificationMgr: Notification dismissed
Note over User,Android: User reopens app
User->>MainActivity: Open app
MainActivity->>MainActivity: onResume()
MainActivity->>ReticulumService: startForegroundService(ACTION_START)
ReticulumService->>ReticulumService: onStartCommand()
ReticulumService->>NotificationMgr: startForeground(service)
NotificationMgr->>Android: Service.startForeground()
Android-->>User: Notification restored
Note over User,Android: Service rebind edge case
MainActivity->>ReticulumService: rebind service
ReticulumService->>ReticulumService: onRebind()
ReticulumService->>NotificationMgr: startForeground(service)
NotificationMgr->>Android: Service.startForeground()
Note over User,Android: Regular notification updates
NotificationMgr->>NotificationMgr: updateNotification()
NotificationMgr->>NotificationMgr: repostNotification()
NotificationMgr->>Android: Service.startForeground()
Note right of NotificationMgr: All updates use startForeground()<br/>instead of notify()
Last reviewed commit: 1a772b8 |
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NotificationManager.notify()cannot restore them — onlyService.startForeground()canstartForeground()instead ofnotify()via a newrepostNotification()helper inServiceNotificationManageronResumetrigger inMainActivityto reinforce the notification when the user reopens the apponRebindinReticulumServicefor the edge case where the binding is dropped and reestablishedTest plan
./gradlew :app:assembleNoSentryDebug./gradlew :app:testNoSentryDebugUnitTest --tests "*.ReticulumServiceBinderTest"🤖 Generated with Claude Code