Search code examples
javaandroidandroid-studiosamsung-mobile

Specify the Samsung My Files start location


Using the following code I can open Samsung's My Files file browser:

Intent samsungIntent= new Intent("com.sec.android.app.myfiles.PICK_DATA");
samsungIntent.putExtra("CONTENT_TYPE", "*/*");
samsungIntent.addCategory(Intent.CATEGORY_DEFAULT);
startActivityForResult(samsungIntent, 123);

I have tried the following to open a specific location:

File root = new File( Environment.getExternalStorageDirectory( ).getPath( ) + "/myFolder" );
Uri uri = Uri.fromFile(root);
samsungIntent.setData(uri);

I get the following message within a new activity:

All apps associated with this action have been turned off, blocked, or not installed.

Is it possible to specify the start location of My Files Samsung file browser?

I found the following question with no answers:

Samsung My Files explorer: Pick file from specified folder


Solution

  • You can set specify the startlocation in samsungIntent by specifying the FOLDERPATH like below.

    Intent intent = new Intent("com.sec.android.app.myfiles.PICK_DATA");
    intent.putExtra("CONTENT_TYPE", "*/*");    
    intent.putExtra("FOLDERPATH", path);   
    intent.addCategory(Intent.CATEGORY_DEFAULT);       
    ((Activity)Forms.Context).StartActivityForResult(intent, 0);