Make action after the user granted permission

Hi !

I have to migrate a Android Studio project on Unity to make an app multiplatform.
However, I have to create a folder after the user granted the permission to write on external storage.
I tested UnityEngine.Android.Permission.HasUserAuthorizedPermission.
I don’t want to wheck if the permission is granted but make an action after granting permission.
How can I do ?

Thanks for answers !

If you use 2020 LTS, there is this API https://docs.unity3d.com/2020.3/Documentation/ScriptReference/Android.Permission.RequestUserPermission.html

where you can pass Android.PermissionCallbacks class to respond to an event when permission is granted.

I use use 2019.3.15. It’s the version used by my company when it began the project.

Sadly those changes won’t be backported to 2019

In that case you would need to create your own java implementation for requesting permissions, alternatively you could try using this implementation https://github.com/Over17/UnityAndroidPermissions, but it’s not an official solution