When listening to an AppState change, inactive is never triggered on Android, only background.
change listener on AppState.background is logged, but never inactivecomponentDidMount() {
AppState.addEventListener('change', this._handleAppStateChange);
}
_handleAppStateChange(currentAppState) {
console.log(currentAppState); // never outputs 'inactive' on android
}
+1 RN 0.44.0, 0.45.1
+1
+1 RN 0.45.1
+1
+1 RN 0.42.0
+1. The inactive state is not sent when receiving a phone call aswell.
Edit: Have a look at AppStateModule. It seems that there are only three states possible: uninitalized, foreground and background. Correct me if I'm wrong, but I don't think that Android has the inactive state, so that would explain why it was not implemented on Android. It would be a good thing to mention in the docs.
@JLWalsh, according to https://stackoverflow.com/a/41009169/3102305, there seems to be an inactive (onPause) event/state.
Hope that helps.
Our issue is, that we want to re-render the main component for privacy reasons as the screenshot of the app that is used in the task list should only show a "covered" version, not the apps last screen.
just for reference: [AppState] App state never becomes "inactive"
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.
I'm not aware that the issue is solved. It would be required to take action when the app goes into background, e.g. covering the app's screen for privacy reasons, so that the system's screenshot in the app-switch does not show the content of the app, but it's lock screen.
Did you find a solution for the described case? @martin-rueegg ?
We need it for the same scenario. Rendering a view before the Snapshot for Task Switcher is made (Android). On iOS it works just fine.
I also discover that when detecting NFC, it will also trigger background and then active.
+1
Most helpful comment
I'm not aware that the issue is solved. It would be required to take action when the app goes into background, e.g. covering the app's screen for privacy reasons, so that the system's screenshot in the app-switch does not show the content of the app, but it's lock screen.