Error in simple sound recorder app

This is as simple an audio recorder app that I could make,
blocks
When I press Start, I get error 802:

I dont actually need to save the recording in a file, it is small, so would like to save it using TinyDB.

Your help would be much appreciated.
warmly,
Arun Mehta

I think you should try to compile the app :wink:

图片1

have you set up a destination name?

try this (not tested)

Tested this, working. The issue with this is that the component automatically saves the recording into a folder that contains spaces, which cannot be created.

SoundRecorder.aia (6.6 KB)

Courtesy Anke for Get the path of → ASD (app-specific dir) & → private data dir (internal storage).

Without setting .SavedRecording the DefaultFileScope must be set to App, because you can only save (write) in one of the Shared folders on Android 11+. The default path for DefaultFileScope=Legacy with the SoundRecorder is:

/My Documents/Recordings/...

and this is of course NOT a Shared folder.
So as @Kevinkun and @gordonlu310 suggested set .SavedRecording.

1 Like

@ewpatton is this already on the bug list to correct?

Taifun

I suggest we pin a bug tracker topic containing all of the current bugs and temporary solutions, so that users will not be confused.

2 Likes

As I mentioned elsewhere earlier, the default path should be removed.
In other words: SoundRecorder.SavedRecording should always have to be set.

2 Likes
1 Like

The issue here isn't so much the default path but rather the use of Legacy. My test app where the DefaultFileScope is set to App works just fine on Android 9. Previously there was a bug where the directories weren't created, but that was fixed in Companion 2.65. The path as shown in the original post though is a legacy mode path, and so that won't work on Android 9 and up. It might make sense in the companion if we add a warning if we detect the device is on Android 9+ or later and Legacy is set as the file scope since it won't work. Legacy was just added as a stop gap for older projects so that they could continue to use the existing file access logic until the apps could be updated. Newer projects should really not be using Legacy unless there's a good reason for it.

Correction: Actually, it was Android 10 (SDK 29) that started enforcing the scoped storage approach, but regardless there's still the line in the sand as drawn by Google.

:+1:

thanks for all your help, friends. Sorry for the delay in responding, I had a spasm in my right arm, and could not use the computer.

Once, things in App Inventor just worked, without needing to know about extensions like GetASD. Ah well

warmly,
Arun

1 Like