-
-
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.request_permission
is now non-blocking
#91194
Comments
Making it non-blocking is desired behavior. If you need permissions to do something, you should wait to do that thing before you do it? |
But in that case, how do I wait for the permission request to be completed? If I can't wait for the permission request to be completed, my game's folders and files will fail to be created until the game is launched a second time... |
@scgm0 It looks like there's a signal emitted once the request finishes: https://github.com/godotengine/godot/blob/86bf8354a06ab7b23a0ff6a81b48fd015e92ac94/platform/android/java_godot_lib_jni.cpp#L508C51-L508C80 BTW, won't this check fail now? It's synchronous.
|
'OnRequestPermissionsResult' doesn't seem to meet my needs, and the following code still can't wait for the permission request to complete:
|
Are you sure this was blocking before? I tried in v4.2.2.stable.official [15073af] and it doesn't block. |
This was changed intentionally in 4.3 and 4.2.2, fixing what was perceived by users as a regression in 4.2:
I don't think we'll change it yet again, it was pointed out that Google's guidelines require it to be non-blocking. CC @m4gr3d |
Not sure, because earlier Android permissions were automatically applied for before godot started, and it was blocking. Later, pr was changed so that I had to use |
I just need a way to wait for the permission request to complete, is it possible to add a signal if I can't block it? |
Yeah, thank you. I agree with the change, just wanted to understand when the change happened to figure out where to document it, I added it to godotengine/godot-docs#9250.
The signal should be |
You mention
Requesting all permissions on start is an anti-pattern, and so it's unlikely we'll revert that change. |
@adamwych |
The expectation is to wait for the permission application to be completed (after the player agrees) before executing the subsequent code. |
@scgm0 to clarify your last comment, do you mean the logic you showed there does not work? |
Yes. |
Tested versions
v4.3.dev.mono.custom_build [00829d37f]
System information
HarmonyOS 4.0.0
Issue description
OS.request_permission
will now not block the game process until the permission request is completed. This is inconsistent with the previous behavior and also breaks some functions of my game. My game requires local storage permissions to create some local folders and files for players to use. So you must make sure to complete the permission application before creating folders and files.Steps to reproduce
Add dangerous permissions and use
OS.request_permission
. After exporting to Android, open the game and a permission application window will pop up. However, the game will not wait for the permission application to be completed and is still running.Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: