Using persistent path to create folder in Android 11
We've got an Android app running using Untiy 2020.3.28. There we're creating a folder using:
savingPath = Path.Combine(Application.persistentDataPath,SessionName);
Directory.CreateDirectory(savingPath);
Where the saving path will be the path to our new folder. Using the CreateDirectory we can create this folder at the given path.
The persistent path on Android is defined by Unity as: /storage/emulated/0/Android/data/<packagename>/files
(which is basically on the internal storage within the data folder)
Where packagename is the name of our app.
On older Android versions this works fine, but with Android 11 we receive an error and cannot grant permission to access the persistent Path. (didn't find the log anymore, but it had something to do with strict mode.)
Further looking around on the internet I saw that for Android 11, they closed a couple of paths to be able to be written on.
Anybody has an idea on how to fix this or knows a work around?