android
runtime_error
ai_generated
true
ForegroundServiceStartNotAllowedException
ID: android/foreground-service-restriction
80%Fix Rate
84%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 14 | active | — | — | — |
Root Cause
Android 12+ restricts foreground service start from background.
genericWorkarounds
-
90% success Use WorkManager for background work instead of foreground service
-
88% success Start foreground service from user-visible context (Activity)
Dead Ends
Common approaches that don't work:
-
Target older SDK to bypass restriction
82% fail
Loses new features, store rejection
-
Start service anyway and catch exception
78% fail
Service doesnt run