-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Make the example android app explicitly handle some device config change events to avoid getting the activity destroyed #18839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the example android app explicitly handle some device config change events to avoid getting the activity destroyed #18839
Conversation
…tation to avoid getting the activity destroyed
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we also add the screenLayout
flag ? This seems to be advised by the android documentation:
Note: If your application targets Android 3.2 (API level 13) or higher, also declare the
"screenLayout" and "screenSize" configurations, because screen layout and screen size can
change when a device switches between portrait and landscape orientations.
It looks like so. I'll add that now. I tried finding if it made a difference somewhere and seems that if you try using split-screen functionality without It is possible that more events of the list should be added just in case, or perhaps try to find a way for bevy to persist if the GameActivity is destroyed/recreated. |
…out changes to avoid breaking on split screen
Looks like in Godot the solution was to basically add most of the list. I have the feeling that the best thing to do would be to add all of them to the list and pass the "onConfigurationChanged" event from android to the user in some way. |
I'm fine with adding the configurations listed by Godot, most of them seem sensible enough (display and keyboards events). For the localization/layout, I've seen posts mentioning that Maybe the only one that I'm not sure about is |
Ok perfect! I'll add that now. I think And yeah, looks like there is a typo on there. Maybe an issue should be raised in their bug tracker. |
…nge events to avoid getting the activity destroyed (bevyengine#18839) # Objective Fixes bevyengine#18316 ## Solution Add android:configChanges="orientation|screenSize" to the AndroidManifest.xml as indicated in https://stackoverflow.com/a/3329486 to avoid the GameActivity from getting destroyed, making the app stuck/crash. ## Testing I checked the results in my phone and after adding the config change the issue went away. The change is relatively trivial, so there shouldn't be the need to make a lot more testing.
Objective
Fixes #18316
Solution
Add android:configChanges="orientation|screenSize" to the AndroidManifest.xml as indicated in https://stackoverflow.com/a/3329486 to avoid the GameActivity from getting destroyed, making the app stuck/crash.
Testing
I checked the results in my phone and after adding the config change the issue went away. The change is relatively trivial, so there shouldn't be the need to make a lot more testing.