Android available mime-types?
AndroidMime TypesAndroid Problem Overview
After several searches online, I couldn't find a place that could tell me every existent mime type for different types of media in android applications.
Here are the ones I know that exist and work:
For Text
"text/plain"
For Image
"image/jpeg"
"image/bmp"
"image/gif"
"image/jpg"
"image/png"
For Video
"video/wav"
"video/mp4"
These are the ones I have and know that work, I am lacking several for video and sound type files. Does anyone know a place where every android mime-type is described or do you guys ever used another mime-type for these different types of media?
EDIT:
I am using this in an application that monitors SMS and MMS and in the MMS type manages the content inside it. The code I have runs for every version above 8.
Android Solutions
Solution 1 - Android
I did some search these days.
maybe you shoud read these links.
- MediaStore supported MIME type is here: http://androidxref.com/4.4.4_r1/xref/frameworks/base/media/java/android/media/MediaFile.java#174
- And there is also a API URLConnection.getFileNameMap()
- And its inner side is here: http://androidxref.com/4.4.4_r1/xref/libcore/luni/src/main/java/libcore/net/MimeUtils.java
Solution 2 - Android
> I couldn't find a place that could tell me every existent mime type for different types of media in android applications
There are over a million applications on the Play Store, plus others elsewhere (e.g., pre-installed on devices, Amazon AppStore for Android). A given device will have some combination of these apps. A given user will have access to some subset of the apps on the device, if the user is running in an Android 4.3+ restricted profile on a tablet.
Hence, there is no way to know, at compile time, what MIME types a given Android device can support for things like ACTION_VIEW
activity requests. The OS itself supports no such MIME types -- they are all provided by applications.
> Here are the ones I know that exist and work:
Some devices may have apps pre-installed that support those MIME types. text/plain
is the least likely of your set to be supported "out of the box".
Solution 3 - Android
You can use existing mapping in Android (java version)
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.toLowerCase());