Forum Discussion
dextro007
1 year agoHonored Guest
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?
3 Replies
Replies have been turned off for this discussion
- dextro007Honored Guest
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.
- Tyke_18Start Member
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.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 8 months ago
- 2 years ago
- 5 months ago
- 25 days ago