My application includes a send feature which presents a list of installed programs to use to send a document. It does this with:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("application/zip");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ docPath));
startActivity(Intent.createChooser(sendIntent, "Email"));
Apps like Gmail and Dropbox appear in the list, but Google Docs does not. In competitor’s apps that use the same document type, Google Docs does appear as an intent. Do I have to use some other method or intent type to get Google Docs to show?
You can research it yourself, run DDMS or LogCat view in Eclipse, and watch debug log written when your or other app starts activity for ACTION_SEND intent.
You’ll see:
Then follow also log when you actually choose app for sending. You’ll see something like this:
Or you may also see this:
You see difference here. One app sets actual mime type = application/zip, other app sets mime type */*. This means that Docs app isn’t designed to send zip files.
Exploring further, use nice app AppXPlore, open Docs, re-create manifest of Docs app, and look at block with UploadSharedItemActivity (the one which matched */* type), on its intent-filter block:
This proves that Docs app is designed to send predefined file types, Zip is not among them.
You app can respect this decision of Docs app, or it can send with */* mime type, but in such case user may be confused why there’re unexpected apps that don’t handle Zip files in the list. I’d rely on 1st option, and using actual mime type.