Almost There - Permission Problem

dlfallen

Active Member
Licensed User
Longtime User
This code works fine on the emulator:
List1 = File.ReadList(File.DirRootExternal, "/B4A/UnitDir/UnitDir.txt")

But it doesn't work on the actual device (which has the text file stored in that path). I get the following error message:
java.io.FileNotFoundException:
/mnt/sdcard/B4A/UnitDir/UnitDir.txt (permission denied)

I thought the use of FileDirRootExternal set the appropriate permissions (per this thread): http://www.b4x.com/forum/basic4andr...als/6808-error-writing-sd-card-how-solve.html

Can someone help me solve this permission problem?
 

dlfallen

Active Member
Licensed User
Longtime User
Indeed, permission was added properly given. I just now discovered this when I unplugged the phone and noticed the program was running just fine. I killed the app (with a 3d party app killer) and launched the program and it runs just fine.

Not sure why I got the error message consistently when plugged into the computer. I plan to port my anagram program over to android and because of the size of the word list, I planned on developing it while connected to the device. I hope I don't have the same permissions problem when I do.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Not sure why I got the error message consistently when plugged into the computer.
My cheap tablet automatically mounts the SD card for computer access as a USB drive when plugged in and the tablet itself no longer sees it until you unplug the USB. My San Francisco offers you the option when you plug it in and if you decline the phone can still see the card but the computer sees an empty drive. Basically only one of them can see the card at once.
 
Upvote 0

dlfallen

Active Member
Licensed User
Longtime User
Thanks for the explanation. Too bad, I guess I'll have to do the development using the emulator. I'll just use a sample (small) version of the word list and substitute the full version when the program is working ok.
 
Upvote 0

dlfallen

Active Member
Licensed User
Longtime User
You can save the files to the internal storage while debugging.

I got the program working just fine, both on the emulator & device. Even with 28,182 words in the list it runs pretty fast, even in the emulator.

The problem is, I can only get it to work with the text files on the SD card, using:
NWords =
File.ReadList(File.DirRootExternal, "/B4A/Words/List1.txt")

I just cannot figure out where to place the text files in internal storage. I would like to distribute the text files as part of the apk package without the need for the user to manually copy the text files to a partaicular path on a SD card.

I'm sure I am just missing a simple concept here, but I have been two days trying to figure it out. Help please?
 
Upvote 0

dlfallen

Active Member
Licensed User
Longtime User
I figured it was something pretty basic. I totally missed the file tab.

Thanks, and happy holidays!
 
Upvote 0

Similar Threads

Top