Add Android Foreground Service
Run code that survives app background. Requires user-visible persistent notification.
Android 14+ requirement
Must declare foregroundServiceType in AndroidManifest.xml:
location— GPS trackingmediaPlayback— audio playbackphoneCall— VoIPconnectedDevice— Bluetooth, Watchcamera— recordingmediaProjection— screen recordingmicrophone— voice recordinghealth— fitness/healthdataSync— file syncshortService— <3 min total
Each requires Play Console justification + video at submission!
RN+Expo approach
bashpnpm add @notifee/react-native
Notifee wraps Android's NotificationCompat + foreground service. Best community option.
tsximport notifee from '@notifee/react-native'; await notifee.displayNotification({ title: 'Tracking workout', body: 'Running for 23 min', android: { channelId: 'workout', asForegroundService: true, ongoing: true, smallIcon: 'ic_notification', }, }); // To stop: await notifee.stopForegroundService();
Service type declaration (config plugin needed)
Inject into AndroidManifest.xml via expo-build-properties:
json{ "expo-build-properties": { "android": { "manifestPlaceholders": { "foregroundServiceType": "location" } } } }
Or use a custom config plugin.
When users will see the persistent notif
ALWAYS while service runs. User can tap to open app, can swipe-dismiss only on Android 14+ if you allow.
Play Console justification
Submit a 30-sec video showing:
- What the service does
- Why the persistent notif is needed
- How users start/stop it
Common rejections:
- "App doesn't need a foreground service for this" → use WorkManager instead
- "Type 'dataSync' used for analytics" → wrong type
- "User can't stop the service"
When NOT to use
- Periodic background work → use WorkManager (no notif required)
- Push notifications → FCM
- Brief tasks (<10 sec) → use coroutine in app
Pair with
add-expo-notifications-fcmfor push (different concern)add-onesignal-pushfor marketing push


