Hello,
Referring to this documentation Open files using storage access framework, we could find the follow introduction:
Android 4.4 (API level 19) introduces the Storage Access Framework (SAF). The SAF makes it simple for users to browse and open documents, images, and other files across all of their preferred document storage providers. A standard, easy-to-use UI lets users browse files and access recents in a consistent way across apps and providers.
Therefore, it's recommended to open files via SAF.
You could try the following code to use SAF in the OpenFolder()
method:
public void OpenFolder()
{
StorageManager sm = (StorageManager)MainActivity.Instance.GetSystemService(Context.StorageService);
Intent intent = sm.PrimaryStorageVolume.CreateOpenDocumentTreeIntent();
String startDir = "Documents"; // You could change startDir to open other dirs, such as DCIM, Downloads...
var uri1 = intent.GetParcelableExtra("android.provider.extra.INITIAL_URI");
String scheme = uri1.ToString();
scheme = scheme.Replace("/root/", "/document/");
scheme += "%3A" + startDir;
var uri = Uri.Parse(scheme);
intent.PutExtra("android.provider.extra.INITIAL_URI", uri);
MainActivity.Instance.StartActivityForResult(intent, 200);
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.