FileSystem can't read from Audio cache (android-only)

I’m getting an unhelpful error from FileSystem on Android when I try to copy a file from the Audio cache.

Snack illustrating the issue (check logs after building in Android to see the error I’m getting): frisky marshmallows - Snack

(PS: Snack’s emulator is giving me a different error on an earlier line, but running it on my physical device gives me the same error I’m getting in my actual project)

For context, I’m writing an app where the user can record a dictation and save it to their device. But when I try to do anything with the URI I get back from getStatusAsync I get an error like the following:

Location '/data/user/0/host.exp.exponent/cache/ExperienceData/%40my-username%2Fmy-project-name/Audio/recording-49ffa475-6bda-42a7-9869-8f6414884ce0.m4a' isn't readable.

So basically it seems like I don’t have read access to the directory where audio is cached in Android. All this seems to work exactly as intended in iOS, so I’m unsure if I’m missing something. Is there a way to either get read permissions for that directory, or tell Expo to cache the Sound in a different location altogether? Any insight would be much appreciated, thanks a bunch

Hey @gslaughl!

In your Snack, you call createNewLoadedSoundAsync() (if you check the Docs for Audio, that method doesn’t exist. I believe you mean to call createNewLoadedSound()

Regardless, I think you are better off just calling recording.getURI() to get the URI for filing, rather than what you are doing on lines 18-19.

Best of luck!

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.