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.