I need a little help on 2 issues

I am trying to code a small custom music player, my first issue is specifying the music file to be played.
music_source

I am trying to specify a specific file in my Music folder, but using this gives me a “Error 701: Unable to load file”. What am I doing wrong?

Secondly, I want to be able to choose a music file at random from the entire /Music folder, I have not been able to figure out how to do that, any help?

Thanks!

Update: I figured out the proper syntax; “/storage/emulated/0/Music/Welcome To My World.mp3”, however, now I am getting a permissions error;

“Error 908: The permission READ_EXTERNAL_STORAGE has been denied. Please enable it in the settings app.”

so, I tried adding this;

Which didn’t seem to have any effect at all.

Try this:

or this:

1 Like

I think you are misunderstanding; the app never asks me for permission.

If you have used this block:

you will definitely be asked for permission.
Of course, I talking about the compiled app (APK).

1 Like

I can quite gaurantee you, it does NOT ask permission.

1 Like

I just checked it. You are correct, the READ permission is no longer added to the Manifest.
It’s a bug. @ewpatton

As a workaround add the File component (as a dummy) into your project. This component adds both permissions to the Manifest (READ-/WRITE_EXTERNAL_STORAGE).

NOTE: To be able to ask for permissions, they must be declared in the Manifest.

1 Like

AWESOME IT WORKS!

Thank you!

Now I just need to figure out how to select a file at random…

@Michael_Cole @Anke Thanks for the investigation into this issue. I’ve prepared a patch that will fix this issue in future releases:

2 Likes

lists_pick_random_item

(draggable)

Hello, I am running into the same problem as well. Could you please tell me what specifically you added to your project to make it work? what does adding a dummy file component mean?

Hello, I am running into the same problem as well. Could you please tell me what does adding a dummy file component mean? I don't understand immediately what I should do.

So drag the File component onto the screen in the Designer.
That's all.

2 Likes

Hello, Thank you so much for the reply. However, the app is still giving me the same permission denied error. I assume I would have to declare it in the manifest, but I don't understand what that means as well. Could you please explain what specifically I should do for that part? Thank you so much for the help.

Set the DefaultFileScope to Legacy in the Designer.

grafik

1 Like

Please note that you should change the Screen's DefaultFileScope property, not the File's.

2 Likes

It Worked!!! Thank you so much.

Seems like I hit this bug as well. The app is working fine on the Android 8 phone but not on the new 14. It gives error "Permission missing. READ_EXTERNAL_STORAGE is required. Bye.". I tried to use advice given by @Anke but seems that there is no such option in the Designer any more.
Thanks

On Android 13+ there is no longer READ_EXTERNAL_STORAGE permission. You must request "READ_MEDIA_IMAGES" (and/or _AUDIO, _VIDEO) on Android 13+. As soon as it is requested via blocks, it is also declared in the Manifest.

See also here: Some basics on Android storage system