Android foreground service types declared correctly
Why it matters
Android 14 (API 34) made android:foregroundServiceType a hard requirement — a service that starts as a foreground service without a declared type throws a MissingForegroundServiceTypeException at runtime and crashes immediately on all Android 14+ devices. As of 2026, Android 14+ accounts for the majority of active Android installs. This is not a review rejection issue; it is a production crash that manifests the moment a user's device upgrades to Android 14. Libraries that depend on foreground services — audio players (react-native-track-player), background location (react-native-background-geolocation), and background sync (expo-background-fetch) — are all affected.
Severity rationale
Low as a submission issue because Google Play does not catch it pre-publication, but the runtime crash on Android 14+ devices makes it a production reliability issue at scale.
Remediation
Add android:foregroundServiceType to each foreground service in android/app/src/main/AndroidManifest.xml:
<service
android:name=".TrackPlayerService"
android:foregroundServiceType="mediaPlayback"
android:exported="false" />
Add the corresponding permission declaration above <application>:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
For Expo Managed Workflow, use a config plugin in app.config.ts to inject the service type attribute, since app.json does not expose this field directly. Test on an Android 14 emulator (API 34) or physical device after making the change — foreground service crashes reproduce immediately in development.
Detection
- ID:
foreground-services - Severity:
low - What to look for: Check
android/app/src/main/AndroidManifest.xmlfor<service>elements. Starting with Android 14 (API 34), foreground services require an explicitandroid:foregroundServiceTypeattribute. Also check for the corresponding<uses-permission>for each service type (e.g.,FOREGROUND_SERVICE_LOCATION,FOREGROUND_SERVICE_CAMERA,FOREGROUND_SERVICE_MICROPHONE). In React Native projects with Expo, checkapp.jsonforexpo.android.permissionsthat include foreground service permissions. Common libraries that use foreground services:expo-background-fetch,expo-task-manager,react-native-background-actions,react-native-track-player,react-native-background-geolocation. If these libraries are present, verify thatandroid:foregroundServiceTypeis declared. Valid types:camera,connectedDevice,dataSync,health,location,mediaPlayback,mediaProjection,microphone,phoneCall,remoteMessaging,shortService,specialUse,systemExempted. Count all instances found and enumerate each. - Pass criteria: All
<service>elements with foreground service behavior have an explicitandroid:foregroundServiceTypeattribute matching their use case; required permissions are declared; or no foreground services are used. At least 1 implementation must be confirmed. - Fail criteria: A
<service>element is present that starts as a foreground service (evident from the library type) but lacksandroid:foregroundServiceTypewhentargetSdkVersionis 34 or higher. - Skip (N/A) when: iOS-only project; or Android project with no foreground service libraries or
<service>elements in the manifest. - Detail on fail:
"react-native-track-player detected but no android:foregroundServiceType='mediaPlayback' declared in AndroidManifest.xml — required for targetSdkVersion 34+". - Remediation: Missing
foregroundServiceTypecauses a crash on Android 14+ devices when the service is started.- Add
android:foregroundServiceTypeto each foreground service declaration inAndroidManifest.xml:<service android:name=".TrackPlayerService" android:foregroundServiceType="mediaPlayback" android:exported="false" /> - Add the corresponding permission above the
<application>tag:<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" /> - For Expo Managed Workflow, add the permission to
app.jsonand use a config plugin to set the service type
- Add
External references
- external · android-foreground-service-types-api34 — Android Developer Docs — Foreground Service Types (API 34+)
Taxons
History
- 2026-04-18·v1.0.0·Initial import from app-store-metadata-listing·automated