-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
OS.alert() not blocking execution on Android and iOS #49969
Comments
cc @m4gr3d I'm not sure whether this is a missing feature or by design. While I agree that |
@Calinou I would venture this is by design on mobile platforms since as you mention, mobile architecture is rather non-tolerant of blocking code (e.g: on Android, the app gets terminated if it's unresponsive for too long). The action item here would be to update the documentation and remove the section about execution being blocked. @dpensky For your use-case I would suggest refactoring your logic so that resource freeing is not conditional on interaction with the alert dialog. Such refactor should actually be valid on all targeted platforms unlike the currently expected behavior. Let me know what you think. |
I'm making this call within a game's auxiliary screen, which by itself already pauses the game and I'm using this alert as a sort of close button to close this screen without the player having to click again on another button just to close this auxiliary screen. |
@dpensky It's indeed intentional on Android platforms. A feature that could help in this scenario would be to add a couple of signals which would be fired when the dialog is opened and closed. This way, you could listen to the This would be straightforward to do on Android, however I'm not familiar enough with the alert dialog logic on other platforms to know if this would be feasible (@Calinou any thoughts on the idea?), so for now, I'd recommend to look for another approach. |
This should be feasible on desktop platforms. However, for this to really make sense, we need to make Also, some people may find the blocking behavior desirable on desktop platforms, so maybe there should be an optional |
This could still be doable on So for example after invoking
So we don't make any breaking changes and just add additional notifications for when the alert dialog is opened/closed. |
We use Lines 1242 to 1245 in 1d910b1
In this case, Android will immediately exit without showing anything. Making it harder to debug simple mistakes. |
I just tested this on iOS and the problem seems to be the same there.
Causes a crash before the alert is even shown on screen. |
Godot version
v3.3.stable.official
System information
Ubuntu 20.04.2 LTS
Issue description
According to the documentation from OS.alert():
This (blocking execution) is not happening on the android exported version of my code:
queue_free() is called immediately.
Did I get something wrong?
Steps to reproduce
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: