Repository navigation
feat(MBL-2666): hand Customer.io silent pushes to a JavaScript handler - #698
Conversation
`CustomerIO.pushMessaging.setBackgroundPushHandler` receives each silent
push as `{ deliveryId, data, deliveryToken }`, and the SDK waits up to
25 seconds for it.
Android: a ContentProvider sets the native fallback callback at process
start. A push runs in a WorkManager job that starts React Native if
needed, waits for JavaScript to register, and runs the handler as a
Headless JS task. iOS: a hook that CioAppDelegateWrapper calls hands the
push to JavaScript through a TurboModule event, and
`NativeMessagingPush.handleBackgroundPush` does the same for app
delegates without the wrapper.
Both platforms take a push only after JavaScript has set a handler, so
other apps see no change. That opt-in lasts across app updates until
JavaScript removes the handler or a push finds none within 25 seconds.
Pushes a React instance didn't finish before a reload go to the next one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sample app builds 📱Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request. Builds are in progress. This comment will be updated when they finish.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 359cfd4. Configure here.
CocoaPods never published the CustomerIO 5.2.0 umbrella pod (trunk timed out mid-release), so iOS = 5.2.0 can never resolve. 5.2.1 and 5.1.1 are the latest releases and only change push_enabled refresh in DataPipelines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| case .unsupported: | ||
| completionHandler(.noData) | ||
| return true | ||
| case .received(let push): |
There was a problem hiding this comment.
This takes every Customer.io silent push even when JS never set a handler, so the app holds the completion for 25s and its other handlers never see the push. Check CustomerIOReactNativeBackgroundPushRouter.isHandlerExpected first and return false, like the wrapper hook above.
There was a problem hiding this comment.
Good catch, fixed in 64b2fe1. The helper still lets the native SDK record Delivered first, then returns false until JavaScript has set a handler, same as the wrapper hook.
|
|
||
| On Android, `onMessageReceived` and `onBackgroundMessageReceived` show nothing for a silent push, track Delivered | ||
| and resolve `true`. React Native Firebase runs `setBackgroundMessageHandler` by starting a service, which Android 8 | ||
| and later refuse for a normal-priority message once the app has been in the background for about a minute; then |
There was a problem hiding this comment.
Android's background limits doc gives this window as several minutes, not about a minute. Suggest "for a few minutes".
There was a problem hiding this comment.
Thanks, changed to "a few minutes" in 64b2fe1.
…handler `NativeMessagingPush.handleBackgroundPush` now returns false when JavaScript has never set a handler, like the CioAppDelegateWrapper hook, so an app delegate without the wrapper keeps the push and its completion handler. The native call still runs first, so Delivered is recorded. Also say React Native Firebase's background service limit applies after a few minutes in the background. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
## [7.3.0](7.2.1...7.3.0) (2026-11-11) ### Features * **MBL-2666:** hand Customer.io silent pushes to a JavaScript handler ([#698](#698)) ([df61523](df61523))

Apps can now handle Customer.io silent pushes in JavaScript (MBL-2666).
CustomerIO.pushMessaging.setBackgroundPushHandlertakes a handler at startup inindex.js, and the handler gets{ deliveryId, data, deliveryToken }for each silent push while the app is in the foreground, in the background, or after the push starts an app that wasn't running. The native SDKs record Delivered themselves, so the handler only deals with the app's data, and an app that never calls it keeps today's behavior.On Android, a ContentProvider sets the native fallback callback from customerio/customerio-android#975 at process start, so a push that starts a killed app reaches the wrapper before JavaScript runs. Each push runs in a WorkManager job that starts React Native if needed, waits for JavaScript to register, and runs the handler as a Headless JS task, which also keeps JavaScript timers running in the background. The job is there because Android won't let a background app start a service for a normal-priority message, which is what React Native Firebase relies on. On iOS, the wrapper sets the
wrapperBackgroundPushHandlerhook from customerio/customerio-ios#1388 at process start, soCioAppDelegateWrapperhands it each silent push after saving Delivered. The push reaches JavaScript through a TurboModule event like our other native events, and the completion handler runs when the handler settles (.newData) or after 25 seconds (.noData). App delegates without the wrapper can callNativeMessagingPush.handleBackgroundPush, which Expo's template will use.Both platforms take a push only after JavaScript has set a handler. That opt-in is saved, so it also covers a push that starts the app after an update, and it turns off when JavaScript calls
remove()or when a push finds no handler within 25 seconds. Pushes a React instance didn't finish before a reload go to the next instance.docs/silent-push.mdcovers both setups (the Customer.io SDK owning push, and React Native Firebase), and the example app sets a handler that logs.Jest (42 tests, 7 for the handler), TypeScript, ESLint and API Extractor pass. I built the example against customerio/customerio-android#975 at bf8ab8db from mavenLocal and customerio/customerio-ios#1388 at 74f25694 as local pods. On an API 35 emulator with fake FCM broadcasts through Firebase's receiver, a push with no saved opt-in recorded Delivered without starting React Native. Once the app had set the handler, foreground, idle background and killed pushes all ran it, including two back-to-back pushes into a killed app and a push right after an app update, before the app was opened. A
setTimeoutin the handler fired each time and nothing was shown. After installing a version without the handler, the first push started React Native, ended at 25 seconds and turned the opt-in off, and the next one only recorded Delivered. On an iOS 26.5 simulator, calling the app delegate the way UIKit does, a fresh install passed the push to the app delegate as before. Once JavaScript had set the handler, pushes at launch before React Native started, in the foreground and in the background reached it and completed.newData, and the helper returned false for a payload without the delivery ID. I couldn't test real FCM or APNs delivery, a real APNs background launch, the iOS timeout and reload paths, or the Android reload path.This pins iOS
= 5.2.1and Android 5.1.1, the latest native releases. Silent push shipped in iOS 5.2.0 (customerio/customerio-ios#1388) and Android 5.1.0 (customerio/customerio-android#975), but CocoaPods never got theCustomerIO5.2.0 pod, and the patch releases only change thepush_enabledrefresh in DataPipelines.🤖 Generated with Claude Code