Skip to content

Feature/boot notification - #6

Merged
hatsch merged 4 commits into
mainfrom
feature/boot-notification
Feb 3, 2026
Merged

hatsch merged 4 commits into
mainfrom
feature/boot-notification

Conversation

@hatsch

@hatsch hatsch commented Feb 3, 2026

Copy link
Copy Markdown
Owner

Android 14+ Boot Notification & FGS Improvements

Summary

Handle Android 14+ restrictions that prevent starting foreground services with restricted types (microphone, dataSync) from BOOT_COMPLETED. Also fix the 6-hour dataSync timeout on Android 15+ by switching to specialUse FGS type.

Changes

Boot notification workaround (Android 14+):

  • Show persistent notification when FGS cannot start at boot
  • Tapping notification or opening the app starts services
  • Notification auto-dismisses after services start successfully
  • Extract notification logic into ServiceAlertNotification class

AudioMonitorService FGS type fix:

  • Change from dataSync to specialUse FGS type
  • Avoids 6-hour timeout that dataSync has on Android 15+
  • Add PROPERTY_SPECIAL_USE_FGS_SUBTYPE with justification for Google Play

Code cleanup:

  • Remove dead code branches for API < 26 (minSdk is 26)
  • Add comprehensive documentation to BootCompatHelper with Android version matrix

Change from dataSync to specialUse foreground service type to avoid
the 6-hour timeout that dataSync has on Android 15+. This allows the
folder monitoring service to run indefinitely.

- Change FOREGROUND_SERVICE_DATA_SYNC permission to FOREGROUND_SERVICE_SPECIAL_USE
- Add PROPERTY_SPECIAL_USE_FGS_SUBTYPE with justification for Google Play
- Update startForeground() to specify FOREGROUND_SERVICE_TYPE_SPECIAL_USE on API 34+
- Remove API < 26 checks (minSdk is 26, else branches were unreachable)
- Simplify overlay permission check (canDrawOverlays available since API 23)
- Add comprehensive KDoc to BootCompatHelper with Android version matrix
- Document FGS restrictions for Android 14, 15, and 16
- Move notification logic from TranslanderApp to ServiceAlertNotification class
- Make notification ongoing (requires tap to dismiss)
- SettingsActivity.onResume() restarts audio monitor if enabled
- Dismiss boot notification after services start successfully

This completes the Android 14+ boot workaround: when FGS cannot start
at boot, user sees a persistent notification and tapping it (or opening
the app) starts the services.
Add service_start_services string to all 24 supported languages.
@hatsch
hatsch merged commit eef1dbc into main Feb 3, 2026
2 checks passed
@hatsch
hatsch deleted the feature/boot-notification branch February 4, 2026 19:28
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