HUAWEI P20 - exact path syntax to "sounds" folder (internal mem - no sdcard)

Hi All,

Because of the big size of the sound files my app needs to play, I have these files stored in my mobile phone, in the "sounds" folder.

When I start my app, I get an error message saying the file cannot be found.I can't find the exact syntax to make my app find the files.

I tried several and many others, like:
/Sounds/PinkNoise.mp3
\HUAWEI P20\Mémoire de stockage interne\Sounds\BrownNoise.mp3
file:///Sounds/WhiteNoise.mp3
...

Does anyone know the correct syntax to my P20's "sounds" folder please?

Hi @flotul welcome to the community,

I think it needs to be file:///mnt/sdcard/Sounds/WhiteNoise.mp3

Hi

You will actually be better off saving the files in the App's Application Specific Directory, because in the near future, that will be the only folder Google is going to allow you to use directly (for security reasons).

However, if your phone is running Android 10, you will need to wait for an App Inventor update (nb185, arriving very soon), because Google has already changed some things and the current App Inventor cannot handle them elegantly.

Taifun's Files extension will certainly make life easier for you:
https://puravidaapps.com/file.php

Thanks to both (sorry, I replied via email first).

Up to now, I couldn't find the correct syntax towards the "Sounds" folder or maybe even better the app's directory.

Still trying....

Have you used the device's file manager to determine the path to your file?

Hello TIMAI2,

Yes, I did.

My P20 has the language set to french so the path is also in french.

It looks like this:
Stockage Interne/Sons/WhiteNoise.mp3

I also tried "//Stockage...", but no, it still isn't the correct syntax.

BTW, I'm wondering if this path is changing with every language - that would really make things complicated, no?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

@flotul Which Android version?

The root directory of the external storage is:

/storage/emulated/0/ 

So the sound folder should be:

/storage/emulated/0/sounds/ 

See also here:

Thank you Anke,

I have Android 10.

My phone has no External Storage.

I just read about "rooted devices" and I don't think mine is one of these unless I manipulate it, I guess.

image

image

Unfortunately, it doesn't work in any case.

I still get error messages when trying to launch the sounds.

image

...my sound files are here.

See here:

a correct relative path would be /Sounds/BrownNoise.mp3
also you might want to remove the redundancy...
use only one Player component and set the corresponding sound before playing

Taifun

This path should work:

file:///storage/emulated/0/Sounds/BrownNoise.mp3

or use the relative path as @Taifun said:

/Sounds/BrownNoise.mp3

Thank you for all your suggestions but none of them works, unforutnately :confused:

image

Your issue with the first one is that "sounds" is lowercase.

Does this APK work on your device? → playSound_API29or30.apk

Does this APK work on your device? Yes it does.