Loading files to /mnt/sdcard or /storage/emulated/0/ or /mnt/asec

1,814 views
Skip to first unread message

aaor...@gmail.com

unread,
May 25, 2014, 4:49:41 AM5/25/14
to mitappinv...@googlegroups.com

Hello!
I used this example to load files http://puravidaapps.com/filebyfile.php

My first tested phone has sdcard, thats why: strPath = /downloads/do-not-delete/

listFilename (amount of this files is big): 
  • myfile1.csv, 
  • myfile2.mp3, 

To read myfile1.csv I used FILE READ sourse: /downloads/do-not-delete/myfile1.csv
To read myfile2.mp3 I used PLAYER sourse: /mnt/sdcard/downloads/do-not-delete/myfile2.mp3

But another tested phone has an itegrated (emulated) sdcard (LENOVO VIBE X)  which adress is: /storage/emulated/0/
Previous FILE READ sourse and PLAYER sourse stopped to work.
Thats why: strPath (was not changed) = /downloads/do-not-delete/
FILE READ sourse: /downloads/do-not-delete/myfile1.csv
PLAYER sourse: /storage/emulated/0/downloads/do-not-delete/myfile2.mp3

QUESTION: 
How to correct str Path, FILE READ sourse and PLAYER sourse that app works properly on phones: 
  • with sdcard 
and 
  • with integrated sdcard 
and 
  • if phone has a slot for the sdcard but the card is absent, files should be written and read in/from memory of the phone (as I understood: /mnt/asec)?

Taifun

unread,
May 25, 2014, 2:38:03 PM5/25/14
to mitappinv...@googlegroups.com
this
file:///storage/emulated/0
should be the same as this more general direction
file:///mnt/sdcard

to read a csv file with the file component, this path should work for you for both devices /downloads/do-not-delete/myfile1.csv
I just tested this on my Nexus 5 successfully
to play a mp3 file, I would suggest to use the full path, which is in your case file:///mnt/sdcard/downloads/do-not-delete/myfile2.mp3
try again and let us know, if it works for you

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

aaor...@gmail.com

unread,
May 25, 2014, 3:22:52 PM5/25/14
to mitappinv...@googlegroups.com
I've just tried. 
But for LENOVO VIBE X (Android 4.2.2.) /mnt/sdcard/downloads/do-not-delete/myfile2.mp3 don't works.  LENOVO VIBE X haven't slot for sdcard (see photo #1)
It works only for HTC Desire V (see print screen #2) which has real sdcard
1.jpg
2.png

Taifun

unread,
May 25, 2014, 4:52:03 PM5/25/14
to mitappinv...@googlegroups.com
just read again what I wrote...
to play a mp3 file, I would suggest to use the full path, which is in your case file:///mnt/sdcard/downloads/do-not-delete/myfile2.mp3
Taifun

aaor...@gmail.com

unread,
May 26, 2014, 1:58:54 PM5/26/14
to mitappinv...@googlegroups.com
Everything work. Thank you for help!
Reply all
Reply to author
Forward
0 new messages