Unable to give permission for All files access
I am currently working on an application that uses a specific document on the users device to transfer information and records between itself and different simmilar applications made by my team (imagine Game A storing its highscores in a shared document so Game B can read those same highscores and incorporate them in Game B).
This methodologie allready works on the Hololens 2 which i have also developed for so i assumed it would work on the Quest 3 aswell. After doing some research i discovered that my best bet would be to try to get All File Access letting me access a shared directory between my different games.
I found some code online that should help me ask for All Files Permission Access, as that isnt natively supported by unity itself.
using var buildVersion = new AndroidJavaClass("android.os.Build$VERSION");
using var buildCodes = new AndroidJavaClass("android.os.Build$VERSION_CODES");
//Check SDK version > 29
if (buildVersion.GetStatic<int>("SDK_INT") > buildCodes.GetStatic<int>("Q"))
{
using var environment = new AndroidJavaClass("android.os.Environment");
//сhecking if permission already exists
if (!environment.CallStatic<bool>("isExternalStorageManager"))
{
using var settings = new AndroidJavaClass("android.provider.Settings");
using var uri = new AndroidJavaClass("android.net.Uri");
using var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
using var currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
using var parsedUri = uri.CallStatic<AndroidJavaObject>("parse", $"package:{Application.identifier}");
using var intent = new AndroidJavaObject("android.content.Intent",
settings.GetStatic<string>("ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION"),
parsedUri);
currentActivity.Call("startActivity", intent);
return true;
}
}
return false;However after trying to ask for permission i am presented with the following screen.
I am not able to manipulate the grayed out checkbox with my fingers or controllers. Is there something i did wrong?
