Skip to main content
New Participant
January 31, 2024

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?

This topic has been closed for replies.

3 replies

dextro007Author
New Participant
January 31, 2024

I seem to have found my solution!

For anyone else struggeling with this problem, make sure you add :

	<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

to the AndroidManifest.xml file.

Inspiring
July 24, 2024

Hi dextro007 , sorry to dig this up, but recently the popup for the permission is all bugged on Quest3 : it appears black or doesn't appear until second launch of the app. Did you notice this too ?

Inspiring
September 12, 2024

Yes I'm having problems too with the request access to storage prompt working within the last couple of weeks. It was working fine and then all of sudden it isn't, no idea what has changed to break it.