android runtime_error ai_generated true

ForegroundServiceStartNotAllowedException

ID: android/foreground-service-restriction

Also available as: JSON · Markdown
80%Fix Rate
84%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
14 active

Root Cause

Android 12+ restricts foreground service start from background.

generic

Workarounds

  1. 90% success Use WorkManager for background work instead of foreground service
  2. 88% success Start foreground service from user-visible context (Activity)

Dead Ends

Common approaches that don't work:

  1. Target older SDK to bypass restriction 82% fail

    Loses new features, store rejection

  2. Start service anyway and catch exception 78% fail

    Service doesnt run