Android Question external storage - direct access to USB-device

fransvlaarhoven

Active Member
Licensed User
Longtime User
Hello,

in Your example You are using the following code to pick a folder:

Dim i As Intent
i.Initialize("android.intent.action.OPEN_DOCUMENT_TREE", "")
i.PutExtra("android.content.extra.SHOW_ADVANCED", True)
StartActivityForResult(i)

Is it possible to pick only the attached usb-stick and not allowing the user to select the sd-card?
 

fransvlaarhoven

Active Member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

It is not possible to limit it.

Starting from Android 8 you can set the initial path, though it will not limit the user from choosing a different one.

I might have asked the wrong question:

what I try to have is a system where the user can only read/write files to the attached USB-stick and has no access at all to the sd-card, internal storage.

From what i can see when running your code, picking a folder returns something like:

Native=(TreeDocumentFile) android.support.v4.provider.TreeDocumentFile@3f0ebee

Is there a standard way to point directly to the attached USB-stick?
 
Upvote 0
Top