-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dn't write on android 14 #100
Comments
You need to use FileBrowserHelpers to work with Storage Access Framework file paths on Android. |
Can you share a code that shows how to do it? |
Example code uses |
This time it didn't even create the file. I need to write the file in multiple times, so copying is not an applicable way. |
May I see your final code? |
I paste in an external file because it interprets it wrong here |
If you'll be passing raw filepaths to FileBrowserHelpers, then you can just use System.IO. It won't work though because of Android's IO restrictions. Which is why you need to use FileBrowser to pick a filepath and use that path in FileBrowserHelpers. Paths returned by FileBrowser won't be raw filepaths but rather Storage Access Framework paths. |
Thanks, I don't know by what sorcery, it works, at least for now. I had come to the conclusion that android had banned writing files to external storage. So it is not possible to export a file to a predetermined location, just asking the user for write permission only first time? Like documents/ap.2020/today.txt I would like to ask you to add public functions to transform from an enum the standard paths, such as home, documents, sd, others, that can then be combined with subpaths |
WRITE_EXTERNAL_STORAGE is removed on latest Android versions so Storage Access Framework is mandatory going forward. persistentDataPath and temporaryCachePath are safe to use, though. There isn't a function that takes a raw filepath and converts it to Storage Access Framework path. If you find a working solution, do let me know. |
OK, I was hoping that was possible. Thanks for the help. |
Description of the bug
Assuming that all I want to file is to write a log file in a subfolder of the home or document folder, regardless of the device, thus without letting the user choose where to save, on android 14 it created a file in the place I selected but did not write the content
Reproduction steps
`using SimpleFileBrowser;
using System.Collections;
using System.IO;
using UnityEngine;
public class SaveFileExample : MonoBehaviour
{
private void Start()
{
SaveFile();
}
}
`
Attach this to any object. The file is created but not written
Platform specs
Please provide the following info if this is a Unity 3D repository.
Additional info
impossible to catch the error
manifest:
``
The text was updated successfully, but these errors were encountered: