feat: add customBaseURL CNAME support to NetworkOptions#701
Conversation
Adds NetworkOptions.Builder.setCustomBaseURL(String) which routes all mParticle endpoint traffic (config, events, identity, alias, audience) through a single HTTPS CNAME host. When set, customBaseURL takes priority over individual domain mappings and rewrites paths to match CDN routing: /config/v4/, /nativeevents/v2/, /identity/v1/, /nativeevents/v1/identity/, /nativeevents/v1/<key>/audience. Also adds R8 keep rules for MParticle$Internal and ConfigManager.getNetworkOptions() so kits can read customBaseURL after minification. The Rokt kit reads NetworkOptions.customBaseURL and forwards it to the Rokt SDK: mparticle-integrations/mparticle-android-integration-rokt#143 Mirrors iOS work from mparticle-apple-sdk#760. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR SummaryMedium Risk Overview Updates Reviewed by Cursor Bugbot for commit 91b1485. Bugbot is set up for automated code reviews on this repo. Configure here. |
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 96950e7. Configure here.
denischilik
left a comment
There was a problem hiding this comment.
Looks good to me but I think customBaseURL lost during database serialization round-trip should be addressed
NetworkOptions.toJson() and withNetworkOptions(String) did not include customBaseURL, so any value was silently dropped when UploadSettings serialized NetworkOptions to the upload database. Events and alias uploads read back NetworkOptions without customBaseURL and routed to the default mParticle endpoints instead of the partner CNAME. Also: - Extract the customBaseURL/DomainMapping host-resolution branch out of getUrl() into a private resolveHost() helper plus a small ResolvedHost value type, lowering getUrl()'s cyclomatic complexity. - Switch java.net.URL / java.net.MalformedURLException to imports. - Add two androidTest cases covering the round-trip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
## [5.79.0](v5.78.5...v5.79.0) (2026-05-14) ### Features * add customBaseURL CNAME support to NetworkOptions ([#701](#701)) ([5285149](5285149)), closes [mparticle-apple-sdk#760](mParticle/mparticle-apple-sdk#760) * Add max persistence age override option [TRIAGE-608] ([#699](#699)) ([ca88322](ca88322)) ### Bug Fixes * increase MPLatch timeout from 5s to 30s ([#695](#695)) ([20f723f](20f723f)) ### Updates & Maintenance * Update submodules ([59a4a9a](59a4a9a))
|
🎉 This PR is included in version 5.79.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |




Summary
Adds
NetworkOptions.Builder.setCustomBaseURL(String)which routes all mParticle endpoint traffic (config, events, identity, alias, audience) through a single HTTPS CNAME host. Mirrors iOS work from mparticle-apple-sdk#760.What changed
NetworkOptions: newcustomBaseURLfield + getter;Builder.setCustomBaseURL(@NonNull String)validates HTTPS scheme, requires a host, and stores host(:port) only — path/query/fragment ignored.MParticleBaseClientImpl.getUrl: whencustomBaseURLis set:DomainMappingandoverridesSubdirectory(unsupported with CDN routing)./config/v4/<key>/config,/nativeevents/v2/<key>/events,/identity/v1/<path>,/nativeevents/v1/identity/<key>/alias,/nativeevents/v1/<key>/audience.android-core/proguard.pro: adds-keeprules forMParticle$InternalandConfigManager.getNetworkOptions()so downstream kits can navigate the public extension surface after R8 minification.Downstream
The Rokt kit reads
NetworkOptions.customBaseURLand forwards it to the Rokt SDK: mparticle-integrations/mparticle-android-integration-rokt#143Test plan
Added 9 androidTest cases in
MParticleBaseClientImplTest:/config/v4//nativeevents/v2//identity/v1//nativeevents/v1/identity//nativeevents/v1/<key>/audienceLocally:
:android-core:testDebugUnitTestpasses (existing unit suite);:android-core:compileDebugAndroidTestKotlincompiles. AndroidTest suite runs on CI emulator.🤖 Generated with Claude Code