I’m using Processing 3.5.4. My app has been working fine on Android 12. Now my phone is updated to Android 13 and my app is no longer working, due to permission changes.
My app needs the permission to generate a file in an directory (in external storage) where user can open it with a 3rd party editor and modify it. Then the app reads the updated file.
If I use the Processing “data” directory I don’t have permission issue. But I have no idea where I can open the file to edit.
According to what I found, Android 13 no longer allows apps to write to external storage (MANAGE_EXTERNAL_STORAGE).
Google have changed how external storage can be accessed. It is no longer possible to have simple write external storage permission. This was a real headache for me when my app stopped being able to use a external SD card!
You are going to have to use the android Storage Access Framework … It means learning new stuff, and I initially thought it pointless, but it does have advantages.
You can read about it in the Android API documentation and I will try to post some getting started code for you later today!
I have few questions…
As I can see, the file can only be saved under “Downloads”. That’s fine for me. But is it possible to create sub-directory in that and save the file?
I also noticed, when I access my phone via PC I see my file saved under “Download” (without ‘s’) and that has one file less than “Downloads”. That’s a bit weird.
@bigboss97
You should be able to save or load from anywhere your phone has access to. If I remember correctly, the default is Downloads, but you should be able to navigate to the SD card, create folders etc and save your file.
Yes it is using a uri … I too wanted to use a file path but you can’t! I think there may be ways to convert between paths and URIs but I’d have to look into it.
I think you will need to use the DocumentFile class … I want to know how to do this too … so I will try!