Samsung My Files explorer: Pick file Intent
Asked Answered
G

1

8

I would like to start an intentchooser which can return any kind of file. The following code works with the usual file explorers (ES, Astro, etc.) but not with the built-in samsung My Files explorer.

Intent selectFile = new Intent(Intent.ACTION_GET_CONTENT);
selectFile.setType("file/*");
startActivityForResult(Intent.createChooser(selectFile, "Select File"), SELECT_FILE);

Does anyone know how to handle that samsung explorer? I tried to use Intent selectFile = new Intent( "com.sec.android.app.myfiles.PICK_DATA") but it doesn't seem to work.

Any ideas? Thanks.

Update: I used this code

Intent selectFile = new Intent();
selectFile.setAction("com.sec.android.app.myfiles.PICK_DATA");
startActivityForResult(selectFile, SELECT_FILE);

but I get this error: FORWARD_RESULT_FLAG used while also requesting a result. Anyone know what does this mean?

Gertudegerty answered 5/5, 2012 at 15:9 Comment(6)
I am not aware that file/ is a valid MIME type prefix, for any MIME type. Please consider */*.Sokul
If I change it to */* I can also see Contacts, Music, etc. but I want to show only file explorers. But still, with */* you cannot see My Files intent. I have to select the my files intent somehow manually.Gertudegerty
"I want to show only file explorers" -- that's nice, but I would not count on all "file explorers" supporting file/*. There are probably hundreds that do not, including Samsung's. I suggest that you solve the problem some other way.Sokul
Samsung's built-in file explorer doesn't work even with */*, that's the problem. Check my updated question, in case you have any more ideas.Gertudegerty
You are welcome to contact Samsung and see if they are willing to support third-party direct use of this app. If they are, they should be able to point you to documentation for its use. Otherwise, just ignore it, as they might make it non-exported in the future, anyway.Sokul
I contacted Samsung. If I get any useful reply I'll post it here.Gertudegerty
L
1
Intent samsungIntent = new Intent();
samsungIntent.setAction("com.sec.android.app.myfiles.PICK_DATA");
samsungIntent.putExtra("CONTENT_TYPE", "*/*");

Changing from setType to putExtra does the trick.

Lough answered 25/10, 2013 at 8:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.