3 ms·
Android 12+: Changing wallpaper or dark theme breaks Flutter and Jetpack Apps
- goodburb 3y agoLifehacker article: https://lifehacker.com/why-you-shouldnt-let-android-12-auto-change-your-wallpa-1847997754 https://lifehacker.com/why-you-shouldnt-let-android-12-auto-...
- veeti 3y agoThe possibility of your process dying at any moment is a fact of life on the Android platform and there is no way around it. Toggling wallpapers or dark/light theme is hardly the only situation in which the process will be restarted. Unfortunately you must do the work of saving and restoring user interface state yourself, and this is a very common cause of bugs for poorly architected native apps as well. I'm not very familiar with Flutter development, but it appears there is some library support to handle this gracefully [1]. Good luck. [1] https://docs.flutter.dev/platform-integration/android/restore-state-android https://docs.flutter.dev/platform-integration/android/restor...
- goodburb 3y agoThis works well, although there is a few seconds delay of freezing and black screen. One of the most popular issues is when the user is using the app (text editing) and then they toggle dark mode from the status bar, not necessarily leaving the app, causing the app to lose context in native or restart in Flutter. This isn't an issue on all other platforms including iOS, and it's heavily used by many users. I guess one of the solutions is to add a dark mode button that is visible all the time inside the app. Android delays dark mode if enabled automatically after locking the screen.