Storage Permission for /mnt/external_sd

texwillerx

Member
Licensed User
Longtime User
My tablet has 8 GB internal storage and I use a 32 GB SD card.

File.DirRootExternal

refers the internal storage (/mnt/sdcard) whereas

/mnt/external_sd

refers to the actual sd card. Since I use huge databases, I have to the use the real sd card, hence the directory /mnt/external_sd. But, when I want to write to an sqlite file which is opened as

dbconnection.Initialize("/mnt/external_sd/", "SOZLUKLER/sozlukler.sqlite", True)

1. No problem if the program is run in debug mode, under IDE environment, connected to device through wireless to B4A - Bridge.
2. If I run the program in release mode, then the program gives

"Attempt to write Readonly Database"

error.

Please help me to overcome this problem (Is there a way to update the manifest to get the storage permission to a directory?)

Regards

PS: I have read the explanations in

http://www.b4x.com/forum/basic4andr...als/6808-error-writing-sd-card-how-solve.html

but these apply to mnt/sdcard only, which is the internal storage for my tablet.
 

texwillerx

Member
Licensed User
Longtime User
This is the solution:

Add the following line to the manifest file using the manifest editor:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

and you will have it in the final manifest file. Hence you will get the write permission to all external media (I haven't checked the usb device but I think it will work also).
 
Last edited:
Upvote 0

Djembefola

Active Member
Licensed User
Longtime User
If you don't want to edit the manifest: the permission is added automatically, whenever you use File.DirRootExternal in your application.


B4X:
Dim dummy as String
dummy=File.DirRootExternal 'Gets sdcard write permission
 
Upvote 0
Top