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.
Seen on:
Android
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
Other ways to find it
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026