fix: [SDK-4742] remove Capacitor activity lifecycle nudge - #27
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
LGTM — clean removal of a now-redundant lifecycle nudge after lifecycle tracking moved into the core Android SDK.
Extended reasoning...
Overview
This PR removes a single Capacitor-only helper, nudgeApplicationServiceForeground(), and its lone call site from OneSignalCapacitorPlugin.initialize(). Two now-unused imports (android.app.Application, IApplicationService) are also dropped. The change is purely subtractive — 17 lines removed, 0 added — in a single Android Kotlin file.
Security risks
None. The change deletes code that synthesized onActivityStarted/onActivityResumed callbacks against the core SDK's application service. It removes a code path rather than introducing one, and touches no auth, crypto, permissions, or data-handling logic.
Level of scrutiny
Low. This is a mechanical deletion driven by an upstream SDK change (SDK-4732) that moved lifecycle observation into the core Android SDK from process start. The behavior the helper was compensating for is now handled before initialize() runs, so the helper is dead weight. Compilation was verified via ./gradlew compileReleaseKotlin and the existing lint/build/test commands.
Other factors
The author noted device-level manual notification flow testing was not run, but the change is a pure removal of redundant code rather than a behavioral addition, and the upstream behavior is owned by the core SDK. No outstanding reviewer comments, no prior bot reviews from me on this PR.
Description
One Line Summary
Removes the Capacitor Android foreground lifecycle nudge now that lifecycle tracking is handled by the core Android SDK.
Details
Motivation
SDK-4732 moved activity lifecycle observation into the core Android SDK from process start, so Capacitor no longer needs to manually replay activity start/resume callbacks after initialization.
Scope
This removes the Capacitor-only
nudgeApplicationServiceForeground()helper and its call from Android initialization. It does not change the public JS API or listener registration behavior.Testing
Unit testing
bun run testManual testing
bun run lintbun run build./gradlew :onesignal-capacitor-plugin:compileReleaseKotlinfromexamples/demo/androidAffected code checklist
Checklist
Overview
Testing
Final pass
Made with Cursor