-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Android: handle suspend / resume #9937
Android: handle suspend / resume #9937
Conversation
Maybe closes #9057? |
No, running in the background is definitely not in the scope of this PR. That's a complex subject on mobile, and it would require a lot more changes. With this PR, the app won't run in background, but it can at least be resumed. |
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.
LGTM. Simple enough of a solution, though one thing to think on. Nothing blocking though.
Changed the behaviour to keep the Bevy window, and only recreate in winit and wgpu |
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.
The approach makes sense and the implementation is clear and concise👍
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.
Even better. Thanks for addressing the UX issue raised.
# Objective - Handle suspend / resume events on Android without exiting ## Solution - On suspend: despawn the window, and set the control flow to wait for events from the OS - On resume: spawn a new window, and set the control flow to poll In this video, you can see the Android example being suspended, stopping receiving events, and working again after being resumed https://github.com/bevyengine/bevy/assets/8672791/aaaf4b09-ee6a-4a0d-87ad-41f05def7945
# Objective - Handle suspend / resume events on Android without exiting ## Solution - On suspend: despawn the window, and set the control flow to wait for events from the OS - On resume: spawn a new window, and set the control flow to poll In this video, you can see the Android example being suspended, stopping receiving events, and working again after being resumed https://github.com/bevyengine/bevy/assets/8672791/aaaf4b09-ee6a-4a0d-87ad-41f05def7945
# Objective - Handle suspend / resume events on Android without exiting ## Solution - On suspend: despawn the window, and set the control flow to wait for events from the OS - On resume: spawn a new window, and set the control flow to poll In this video, you can see the Android example being suspended, stopping receiving events, and working again after being resumed https://github.com/bevyengine/bevy/assets/8672791/aaaf4b09-ee6a-4a0d-87ad-41f05def7945
# Objective - Handle suspend / resume events on Android without exiting ## Solution - On suspend: despawn the window, and set the control flow to wait for events from the OS - On resume: spawn a new window, and set the control flow to poll In this video, you can see the Android example being suspended, stopping receiving events, and working again after being resumed https://github.com/bevyengine/bevy/assets/8672791/aaaf4b09-ee6a-4a0d-87ad-41f05def7945
# Objective - Handle suspend / resume events on Android without exiting ## Solution - On suspend: despawn the window, and set the control flow to wait for events from the OS - On resume: spawn a new window, and set the control flow to poll In this video, you can see the Android example being suspended, stopping receiving events, and working again after being resumed https://github.com/bevyengine/bevy/assets/8672791/aaaf4b09-ee6a-4a0d-87ad-41f05def7945
Objective
Solution
In this video, you can see the Android example being suspended, stopping receiving events, and working again after being resumed
android-suspend.mp4