react-native
react-native copied to clipboard
Android: AppState.memoryWarning never called for Android
Description
The memoryWarning event of AppState appears to be iOS-only, as it is never called on Android.
Android has an onTrimMemory callback that seems to be analogous to the iOS didReceiveMemoryWarning. Could that be used?
React Native Version
0.71.3
Output of npx react-native info
System: OS: Windows 10 10.0.22621 CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz Memory: 4.65 GB / 23.86 GB Binaries: Node: 18.14.2 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: AI-213.7172.25.2113.9123335 Visual Studio: 16.11.31729.503 (Visual Studio Community 2019), 17.4.33122.133 (Visual Studio Professional 2022) Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.3 => 0.71.3 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Subscribe to the AppState.memoryWarning event.
Snack, code example, screenshot, or link to a repository
I have an app in the field (We Ski and Snowboard Tracker) where memoryWarning events are logged to firebase. 100% of those events are iOS.
:warning: | Newer Version of React Native is Available! |
---|---|
:information_source: | You are on a supported minor version, but it looks like there's a newer patch available. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
In v0.71.4, if I invoke a send-trim-memory event via adb, I get a memoryWarning event. Was this added recently to Android?
Edit: I only get a memoryWarning on debug builds. Why is this not supported on release builds?
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.