Context.startForegroundService() did not then call Service.startForeground() / ForegroundServiceStartNotAllowedException
A foreground service didn’t call startForeground() within a few seconds, or the app tried to start one from the background where Android 12+ forbids it.
did not then call Service.startForeground()startForegroundService() not allowed due to mAllowStartForeground false Meaning
Android 14 also requires a foregroundServiceType declared in the manifest plus the matching FOREGROUND_SERVICE_* permission. Background starts should use WorkManager (expedited work) instead.
Common causes
- startForeground() not called quickly in onStartCommand
- Started from background (Android 12+ restrictions)
- Missing foregroundServiceType/permission (Android 14)
- Notification channel missing
⚡ Quick fix
- Call startForeground() immediately with a notification
- Declare android:foregroundServiceType and the permission
- Use WorkManager for background-initiated work
Detailed fix by platform
XML
- kotlin
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" /> <service android:name=".SyncService" android:foregroundServiceType="dataSync" android:exported="false" />
How to diagnose
- Timing — startForeground called within 5–10 s?
- Start — From foreground or background?
- Manifest — Type and permission
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 0x80070422 Windows Update error 0x80070422 (service is disabled)
- FLAG_IMMUTABLE or FLAG_MUTABLE Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
- Job for x.service failed Job for nginx.service failed because the control process exited with error code
Most viewed in Android
- Could not resolve Gradle: Could not resolve all files for configuration / Could not resolve dependency
- Unsupported class file major version Gradle: Unsupported class file major version / Android Gradle plugin requires Java 17 to run
- INSTALL_PARSE_FAILED_NO_CERTIFICATES INSTALL_PARSE_FAILED_NO_CERTIFICATES / App not installed as package appears to be invalid
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026