Skip to content
Narvy

Foreground service type and permission missing on Android 14

From targetSdkVersion 34, every service started in the foreground must declare android:foregroundServiceType, and the app must request the matching FOREGROUND_SERVICE_<TYPE> permission. Otherwise startForeground() throws and the app crashes. Declare the type, add the permission, pass the type to startForeground.

Logcat, at runtime
android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{...} targetSDK=34
Logcat, at runtime
java.lang.SecurityException: Starting FGS with type camera callerApp=ProcessRecord{...} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_CAMERA]

What it means

Android 14 made the type of each foreground service mandatory, so the system and Google Play know why the service runs (media playback, location, data sync, and so on). Each type has its own permission on top of android.permission.FOREGROUND_SERVICE; some types also need a runtime permission such as camera or location.

The store check reports two things: the app requests FOREGROUND_SERVICE but no service declares a type, and a service declares a type without its FOREGROUND_SERVICE_* permission. Both are reported as info: they crash at runtime only when the service is actually started, and services declared by libraries often list types the app never uses.

Deadline

No store date: the rule applies as soon as targetSdkVersion is 34 or higher, which Google Play's target API requirement makes mandatory.

How to fix it

1. Declare the type and its permission

AndroidManifest.xml
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

<service
    android:name=".PlayerService"
    android:foregroundServiceType="mediaPlayback"
    android:exported="false" />

2. Pass the type when you start it

PlayerService.kt
ServiceCompat.startForeground(
    this, NOTIFICATION_ID, notification,
    ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
)

3. Clean up what you do not use

If the app requests FOREGROUND_SERVICE but runs no foreground service, remove the permission. If a library declares a type you never start, its missing permission is harmless at runtime, but the type still needs a Play Console declaration (see the related page).

Check before you submit

Upload the APK, AAB or split-APK set (XAPK, APKS, APKM) on the store check page. It runs PLAY-FGS-TYPE PLAY-FGS-PERMISSION against the dates on this page, then deletes the file: nothing about the app is kept. The same engine runs offline in the Narvy CLI, and exits with code 1 when a blocker is found, so it can gate a CI job.

Offline, from a terminal (narvy-cli 1.2.0 or later)
narvy store-check app-release.aab

Check a build in the browser

FAQ

Which type should I pick?

The one that matches what the user sees: mediaPlayback, location, dataSync, connectedDevice, camera, microphone, phoneCall, health, remoteMessaging, mediaProjection, mediaProcessing, shortService, specialUse or systemExempted. Android's service types page lists the conditions of each.

Does shortService need its own permission?

No. shortService only needs FOREGROUND_SERVICE; the store check does not expect a type-specific permission for it.