Skip to content

fix(android): report React Native wrapper type on every selectPlacements call#357

Open
denischilik wants to merge 1 commit into
mainfrom
fix/android-rokt-wrapper-sdk-type
Open

fix(android): report React Native wrapper type on every selectPlacements call#357
denischilik wants to merge 1 commit into
mainfrom
fix/android-rokt-wrapper-sdk-type

Conversation

@denischilik

Copy link
Copy Markdown
Contributor

Summary

On Android, the React Native wrapper SDK type was reported to mParticle only once, in the MPRoktModuleImpl constructor. That one-shot call is silently dropped in two common cases:

  • MParticle.getInstance() is still null when the native module is created (mParticle not started yet), and the call is never retried.
  • The Rokt kit has not finished initializing when the call fires. KitManagerImpl.setWrapperSdkVersion only forwards to already-active kits and, unlike iOS (which queues kit calls until kits are initialized and replays them), Android has no queuing, so the value is lost.

As a result the Rokt SDK falls back to reporting android as the framework type for React Native integrations, while iOS correctly reports reactNative. iOS already re-sends the wrapper type on every placement call; this change aligns Android with that behavior by reporting the wrapper type at the start of every selectPlacements call (both old and new architecture), in addition to module creation.

Testing Plan

  • Added unit tests for MPRoktModuleImpl covering: wrapper type reported at module creation, reported on each subsequent call, and no crash when mParticle is not started.
  • ./gradlew test, ./gradlew ktlintCheck, ./gradlew lint, and trunk check all pass locally.
  • Suggested additional validation: run the sample app with the Rokt kit configured and confirm SDK diagnostics report reactNative as the framework type on Android.

Master Issue

Closes https://go.mparticle.com/work/REPLACEME

…nts call

The wrapper SDK type was only reported once at module creation. If
MParticle was not started yet, or the Rokt kit had not finished
initializing, the call was silently dropped and never retried, so the
framework type fell back to android. iOS already re-sends the wrapper
type on every placement call; this aligns Android with that behavior.
@denischilik
denischilik requested a review from a team as a code owner July 20, 2026 16:34
@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Small, idempotent metadata call before placement selection; no auth, data, or placement logic changes.

Overview
Android Rokt now re-reports WrapperSdkReactNative to mParticle on every selectPlacements call (old and new architecture), not only when MPRoktModuleImpl is constructed. A new public setWrapperSdk() wraps the existing MParticle.setWrapperSdk call so placement entry points can retry after mParticle and kits are ready—matching iOS and fixing diagnostics that incorrectly showed android instead of reactNative.

Module init still calls setWrapperSdk() once at creation. Unit tests cover creation-time reporting, repeated calls, and a null MParticle instance.

Reviewed by Cursor Bugbot for commit f2dd324. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants