Forum Discussion
IOS background events not firing but Android does
When audio is playing on our mobile app, and the listener puts it into the background, Braze can successfully send the 1-minute events on Android, but not on iOS. Our app is in React Native.
Help Please, if anyone has encountered a similar issue and how to resolve it.
On iOS, the SDK seems to record all background events correctly, but does not send them to the Braze server until the app returns to the foreground — at which point all queued events are sent in one batch. If the app is closed before returning to the foreground, those background events are lost.
This behaviour suggests that the Braze SDK disables data flushing while the app is in the background on iOS. I also noticed that whenever the app goes to the background on iOS, Braze logs a “session end” event, followed by all the accumulated background events when the app returns to the foreground — which further indicates that the SDK pauses data flushing during background execution.
We have tried the following without success:
- Adding background-fetch and remote-notification to UIBackgroundModes in Info.plist. (I didn't think this could fix the issue but just tried it)
- Calling requestImmediateDataFlush() immediately after each logCustomEvent().
We use the "react-native-background-timer" package to send periodic pings (1 min to our backend API, and 10 min to Google Analytics using "@react-native-firebase/analytics"), and those continue to work reliably in the background — suggesting the limitation lies specifically within the Braze SDK rather than iOS itself.
1 Reply
- LiorPelegExpert
iOS is very aggressive about suspending threads when the app goes into the background, so Braze cannot flush data until the app is reopened.
requestImmediateDataFlush() works, but only if the process is still running. If the app is already suspended, it will not execute.
Braze documents this behavior here: https://www.braze.com/docs/user_guide/administrative/app_settings/event_user_log_tab
What you can try:
1. Force a flush when entering background
Use the applicationDidEnterBackground event.
Start a short background task, call requestImmediateDataFlush(), then end the task.
This gives the SDK a short time window to send data before suspension.2. Use the Background Tasks API
Apple provides a way to schedule background refreshes that periodically wake the app. See: https://developer.apple.com/videos/play/wwdc2025/2273. Silent pushes
Send silent push notifications to wake the app and then call requestImmediateDataFlush().4. Braze SDK Debugger
Braze recently added a debugger that can export session logs as CSV. I’d check it as well to see if you can get more details about what happens to background events.5. Server-side fallback
Since you mentioned your backend is already receiving events reliably, you can use Braze’s REST API (/users/track) to send those events directly from your server. I’d keep this only as a fallback for critical events when the app is backgrounded, because sending via the SDK has advantages (for example, enabling in-app message triggers)
Related Content
- 10 days ago