There are no shortage of threads about accessing files on Android. But I still can’t figure out how, with the most recent flavours of Android, I can get access a file in the external storage folder. It’s an expansion file and according to googles docs it will live here:
<shared-storage>/Android/obb/<package-name>/
I know the package-name, what I don’t know is the path to <shared-storage>
. I only need to open it. The most recent threads seem to suggestion that juce::File
isn’t all that useful on Android, and that the new juce::AndroidDocument
class should be used instead. If so, does anyone have an example of use i for this purpose?
I guess I can just some JNI methods to get the path. That should work for this. But I’m still keen to know if there is an easier way.
1 Like
As far as I can tell:
- opening a file with AndroidDocument only works if the user purposedly and wantedly selects the file using the native fileChooser - you can’t arbitrarily programmatically open a file by pointing at its url (so many adverbs…)
- the Juce people don’t give much attention to Android
- every time I try to do something with Juce on Android I realize that I could spend my time in a more productive way
Also I don’t understand the need to have separate classes for File, URL (localFile) and AndroidDocument in a multi-platform framework. I want to File::open()
on any platform regardless of what’s happening under the hood.
3 Likes
I don’t use JUCE on Android, but I get the Environment.getExternalStorageDirectory()
from Java, and then pass it over JNI.
Yes, this is also what I’m doing now. A little clunky but it works fine.