Android Question ExternalStorage - Read from app directory and write to SD card

Dave G

Active Member
Licensed User
I can read from an external SD card and write to my app's directory (rp.GetSafeDirDefaultExternal("")), but not to any directory outside of my directory.
In manifest:
AddManifestText(
<uses-permission
  android:name="android.permission.WRITE_EXTERNAL_STORAGE"
  android:maxSdkVersion="19" />
)

Is it possible to write to the SD Card? If so, how do I get the "externalDirectory" to reference in the following code:
Write to external:
Dim out As OutputStream = File.OpenOutput(externalDirectory, f.Name, False)

I'm trying to figure out a way to export the SQLite database with data captured while not connected to a network. If the data is on a SD Card then it can be attached to an email and sent. Newer versions of Android lock down everything pretty tightly, for good reason, but make it difficult for us good folk.

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Dave G

Active Member
Licensed User
Looking at the IDE autocomplete for 'Storage...', I see these methods: CreateNewDir, CreateNewFile, OpenOutputStream?
I believe that those functions can only be used within the application's directory. Any attempt I've tried outside of the application directory results in a Permission Denied error.
 
Upvote 0
Top