How to get MP3 files

How to get MP3 files from device and SD Card storage ?

First you will need to declare read permissions

If you want to scan and grab all .mp3 files
You should use the activity starter or some of the extensions available.

If you only want to get the specific files from a specific folder
Same as above, just specify the folder address and you can use either the activity starter, extension or a component that the builder already has.

@Pankaj_Developer Firstly what have you tried so far?

Here the app crashes.

give

storage/emulated/0/

or

file:///mnt/sdcard/

as directory name

Try this: listFiles.apk (4.6 MB)
Does it work on your device?

Yes it’s working

@Anke Yes it’s working can i know how did you managed to search files without MANAGE_EXTERNAL_STORAGE permission on Android 11 because i used taifun files extension to get a list of all the .pdf files but i didn’t get them with read permission but with MANAGE_EXTERNAL_STORAGE i got them all.
Thanks


Ops!!
@Anke see this


I am too confused
Searched here but didn’t got any solution

Show it’s code

You must write block code :slightly_smiling_face: not simple code

I mean, I didn’t understand anything.
Just tell me how will the Mp3 file get ?

@Pankaj_Developer Use like this

Apk:- test.apk (4.2 MB)

AIA:-
test.aia (35.2 KB)

It is taking a lot of time to get the file.
There is some way to get early or once get doesn’t have to get again.

Because it’s searching full storage instead you can save the file path in tiny db and on second start just load the file paths

It’s all explained in this overview:

  • Regardless of the Android version, all media files in external storage can be read.

  • However, write access is only available for certain Shared folders (/Documents, /Download, /Music, etc.).

  • For non-media files, write access is only available for these two Shared folders (/Documents and /Download).

  • However, full access (read / write) to the ASD and the private directory (internal storage) only exists for the respective app.

Note: Read / write access to the Shared folder should not require READ / WRITE permissions on Android 11+ (neither for media files nor for non-media files). This bug with Niotron & AI2 has not yet been fixed, although I have pointed it out several times.

1 Like

Btw, the TaifunFile.FileListAsync block should be in the Permission.Granted event and should only be called in the Screen.Initialize event after READ permission is granted.

1 Like

Yes, but then newly added MP3s will not be listed.
Also, your app doesn’t list files from a removable MicroSD card. Mine does that if one is available. I put most of my (nearly 10000 MP3s) in there.

2 Likes

Yes you are absolutely Right

Sorry I didn’t added that i am still a learner and
Moreover Thanks To you cause all of this and maximum of thing about storage i have learnt form you only :blush:

1 Like

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