Important platform limitations for Android and iOS
masterBefore using react-native-background-actions, understand the underlying platform mechanisms and their limitations:
Android
- Mechanism: Relies on React Native's
HeadlessJS. - Behavior: Jobs run even if the app is closed.
- Android 12+ Restrictions: You cannot launch background tasks from the background.
- Notifications: A notification is required and will be shown whenever a task is running. It is impossible to start the service without this notification. The notification is only visible on Android.
iOS
- Mechanism: Relies on
UIApplication beginBackgroundTaskWithName. - Limitation: This method will not keep your app in the background forever on its own.
- Workaround: To achieve long-running background execution on iOS, you must combine this library with other capabilities that keep the app alive, such as audio playback (e.g., using
react-native-track-player) or geolocalization.