Search code examples
androidandroid-intentmime-typesmime

Which mimeType to choose for a generic file in Android?


I am working on an Android application that needs to request files of any kind to others. For this reason, I am using a code like the following, as per Android documentation:

mRequestFileIntent = new Intent(Intent.ACTION_PICK);
mRequestFileIntent.setType(genericMimeType);
startActivityForResult(mRequestFileIntent, 0);

At the beginning I had genericMimeType = "*/*", but the problem with this approach is that we can also get results with mime type vnd.android.cursor.item/contact, so a cursor. Is there an easy way to limit the mime type only to files, that for example can be sent as attachments in an email?


Solution

  • A generic mime-type would be :

    application/octet-stream