chol0p 0 Posted May 22 Hi all. I hope very much for your help. Is it possible to simply open a folder from application through a standard file manager? I save my images (photos from the camera) in the DCIM/MyFolder and I would like to add the ability for the user to open this folder from my application. So that when a button is pressed, he has a choice of applications (available file managers) through which he can open it. I will be grateful for help. Sorry, I'm using a translator. Thank you Share this post Link to post
Mustafa ֍zgun 7 Posted May 24 Hi apps targeting Android 10 and higher are given scoped access into external storage, or scoped storage. Android 11 introduces changes and restrictions to enhance user privacy, including the following: Scoped storage enforcement: Access into external storage directories is limited to an app-specific directory and specific types of media that the app has created. Open files using the Storage Access Framework The SAF includes the following: Document provider: a content provider that lets a storage service, such as Google Drive, reveal the files it manages. A document provider is implemented as a subclass of the DocumentsProvider class. The document-provider schema is based on a traditional file hierarchy, though how your document provider physically stores data is up to you. The Android platform includes several built-in document providers, such as Downloads, Images, and Videos. Client app: a custom app that invokes the ACTION_CREATE_DOCUMENT, ACTION_OPEN_DOCUMENT, and ACTION_OPEN_DOCUMENT_TREE intent actions and receives the files returned by document providers. Picker: a system UI that lets users access documents from all document providers that satisfy the client app's search criteria. https://developer.android.com/static/images/providers/storage_picker.svg Access documents and other files from shared storage Sample project Delphi - Android Scoped Storage : Storage Access Framework SAF API 1 Share this post Link to post
Minox 3 Posted Thursday at 10:12 AM If you have the rights to access the "DCIM/MyFolder" folder, you could build a simple browser (via "System.IOUtils.TDirectory.GetFiles") yourself and display the files contained in a list. Or launch an "Intent" with "ACTION_GET_CONTENT", to open the system app 1 Share this post Link to post
chol0p 0 Posted Friday at 12:05 PM On 5/25/2023 at 1:12 PM, Minox said: If you have the rights to access the "DCIM/MyFolder" folder, you could build a simple browser (via "System.IOUtils.TDirectory.GetFiles") yourself and display the files contained in a list. Or launch an "Intent" with "ACTION_GET_CONTENT", to open the system app Could you show an example how to implement this using "ACTION_GET_CONTENT"? I already tried this with "Intent" but I keep getting the error " exposed beyond app through intent.getdata() " Share this post Link to post
Dave Nottage 358 Posted Friday at 12:10 PM 5 minutes ago, chol0p said: I already tried this with "Intent" but I keep getting the error " exposed beyond app through intent.getdata() " Please show your code Share this post Link to post
Minox 3 Posted Saturday at 10:01 AM I use this: uses Androidapi.JNI.GraphicsContentViewText, Androidapi.Helpers, System.Messaging, Androidapi.JNI.Net, Androidapi.JNI.App, PROCEDURE TForm1.GetFileBrowser; VAR Intent : JIntent; ReqCode : Integer; BEGIN ReqCode := 1000; Intent := TJIntent.Create; Intent.setType(StringToJString('*/*')); Intent.setAction(TJIntent.JavaClass.ACTION_GET_CONTENT); Intent.putExtra(TJIntent.JavaClass.EXTRA_ALLOW_MULTIPLE,true); TMessageManager.DefaultManager.SubscribeToMessage(TMessageResultNotification, procedure(const Sender : TObject; const aMessage : TMessage) VAR msgRES : TMessageResultNotification; begin msgRES:= TMessageResultNotification(aMessage); If msgRES.RequestCode=ReqCode Then if (msgRES.ResultCode=TJActivity.JavaClass.RESULT_OK) Then Begin URIfileTrn := msgRES.Value.getData(); //URI sing file selez If URIfileTrn=Nil Then //multiselez ClipDataF := msgRES.Value.getClipData; End; end); TAndroidHelper.Activity.startActivityForResult(Intent, ReqCode); END; and then via thread process the URI 1 Share this post Link to post
chol0p 0 Posted Saturday at 11:41 AM 1 hour ago, Minox said: I use this: Thanks, but I just need to open the folder, without selecting the folder. Is it possible? Share this post Link to post
Minox 3 Posted Saturday at 01:11 PM (edited) If your intention is to open the explorer automatically in a specific location, I don't think it's possible to do it with the system one. Third-party ones do it instead, but I've never faced the problem. This session could be a good start to understand if there is a possibility to do it. Edited Saturday at 01:13 PM by Minox 1 Share this post Link to post