feat(analytics-react-native): add appLifecycles plugin#1789
Draft
daniel-graham-amplitude wants to merge 5 commits into
Draft
feat(analytics-react-native): add appLifecycles plugin#1789daniel-graham-amplitude wants to merge 5 commits into
daniel-graham-amplitude wants to merge 5 commits into
Conversation
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Checklist
Note
Low Risk
Optional analytics enrichment with no auth or data-model changes; behavior is covered by unit tests including subscription teardown.
Overview
Adds
appLifecyclePluginto@amplitude/analytics-react-native, exported from the package entry point. The enrichment plugin listens to React NativeAppStateand emits[Amplitude] Application Openedwhen the app becomes active and[Amplitude] Application Backgroundedwhen it goes to background; it logs ifAppStateis missing and cleans up viaremove()or legacyremoveEventListener.The Expo example wires
add(appLifecyclePlugin())instead of the browser page-view plugin and drops the previousautocaptureinit options. Unit tests cover setup, tracking, pass-through execute, teardown, and the unavailable-AppStatepath.Reviewed by Cursor Bugbot for commit a8054d9. Bugbot is set up for automated code reviews on this repo. Configure here.