godot: 3.2.4 breaks onMainRequestPermissionsResult callback for Android Plugins
Godot version: 3.2.4-rc5 (also tested 3.2.4-rc3)
OS/device including version: Android 7, LG-H850
Issue description:
Moving from 3.2.3-stable to 3.2.4 the onMainRequestPermissionsResult function in my Android plugins has stopped being called.
The relevant plugin code looks like this:
public class PluginName extends GodotPlugin {
private Activity activity;
private permissionName = Manifest.permission.READ_EXTERNAL_STORAGE; //Which permission is being requested makes no difference
private requestCode = 107;
public PluginName(Godot godot) {
super(godot);
activity = getActivity();
}
public void onMainRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
//This never gets called
}
public void askForPermission(String permissionName, int requestCode) {
ActivityCompat.requestPermissions(activity, new String[] {permissionName}, requestCode);
}
}
This works perfectly when running 3.2.3-stable.
In 3.2.4, the permission still gets requested, the dialog pops up when testing, and confirming the dialog does indeed grant the permission successfully. It’s just the onMainRequestPermissionsResult callback that never comes through, meaning the Plugin never finds out if the request was successful, which is quite important for the flow of a bunch of my plugins.
Both for 3.2.3-stable and 3.2.4 i use their respective unmodified Android Build Templates.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (8 by maintainers)
@m4gr3d I don’t, that sounds like the way to go! 👍 The double callback i do not think should be cause for any problems since checking for a matching
requestCodei expect would be standard practice anyway.Thanks for the detailed update @minosvasilias! I’ll take a look at the issue.
@minosvasilias I’ll also add a fix to support your original code. We want to maintain backward compatibility as there may be plugins that don’t get updated in time which would cause a loss of functionality for users.