Android 15 foreground service quirks
Each Android version tightens background work rules. API 34 added types. API 35 added permission tiers. What broke and how to fix.
Foreground services keep your app running with a persistent notification. Used for music players, location tracking, downloads. Each Android version since 12 has tightened rules.
Android 14 (API 34) requirements:
- Type declaration in manifest: location, mediaPlayback, dataSync, mediaProjection, etc.
- Permission per type: FOREGROUND_SERVICE_LOCATION, FOREGROUND_SERVICE_MEDIA_PLAYBACK, etc.
- Restrictions on starting from background — must be foreground or have allowlist exemption.
- Mandatory user-visible notification within seconds.
Android 15 (API 35) additions:
- Type-specific permissions are stricter — wrong type means service start fails outright.
- User can dismiss the notification — service continues but loses lifecycle priority.
- Battery saver mode kills foreground services more aggressively.
What breaks:
- Old code launching foreground service from BroadcastReceiver — fails on Android 14+.
- Missing permission declarations — runtime crashes.
- Code that assumes notification is always visible — Android 15 user can dismiss it.
Modern alternative: WorkManager. It chooses how to run a task — foreground, scheduled, expedited. Hides the foreground service complexity. For new code, prefer WorkManager unless you really need persistent foreground (music, navigation).