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?

Glenn Sallis
  • 415
  • 3
  • 11
steliosf
  • 3,669
  • 2
  • 31
  • 45
  • I am not aware that `file/` is a valid MIME type prefix, for *any* MIME type. Please consider `*/*`. – CommonsWare May 05 '12 at 15:27
  • 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. – steliosf May 05 '12 at 16:04
  • "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. – CommonsWare May 05 '12 at 16:16
  • 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. – steliosf May 05 '12 at 16:33
  • 1
    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. – CommonsWare May 05 '12 at 16:40
  • I contacted Samsung. If I get any useful reply I'll post it here. – steliosf May 05 '12 at 16:54

1 Answers1

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.

Konrad Nowicki
  • 1,929
  • 1
  • 14
  • 11