The API call is in a sample application to demonstrate that Android probably does not have an extension to MIME-type mapping for this particular MIME-type.
The main application I am working on does register itself for the MIME-type in question (via AndroidManifest.xml) but still does not receive the intents and I think that's because of the lack of mapping for this MIME-type in Android. Is there a way I can add this mapping to Android? For example, add a mapping for "*.xyz" to "application/xy+z" and vice versa so that when the user taps on ABC.xyz in a 3rd-party file explorer, an intent with MIME-type "application/xy+z" is sent to applications who register for it in their AndroidManifest.xml. Thanks, -Varun On Fri, Jan 29, 2010 at 4:26 AM, Dianne Hackborn <[email protected]> wrote: > The API you are calling is just for the web kit when running in your own > process. If you want other apps to be able to see what you can do, that is > what AndroidManifest.xml is for. > > On Thu, Jan 28, 2010 at 6:08 AM, Varun Khaneja <[email protected]> wrote: >> >> Hi, >> >> I want to register my application for files of a certain popular and >> well-documented MIME-type. >> The problem is that Android does not seem to recognize this MIME-type. >> >> The following sample code demonstrates this: >> >> package com.example.helloandroid; >> >> import android.app.Activity; >> import android.os.Bundle; >> import android.util.Log; >> import android.widget.TextView; >> >> public class HelloAndroid extends Activity { >> /** Called when the activity is first created. */ >> �...@override >> public void onCreate(Bundle savedInstanceState) { >> super.onCreate(savedInstanceState); >> TextView tv = new TextView(this); >> tv.setText("Hello, Android"); >> setContentView(tv); >> String extn = >> android.webkit.MimeTypeMap.getFileExtensionFromUrl("/data/a.xyz"); >> String xyzMimeType = >> android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension >> (extn); >> Log.d ("HelloAndroid", "extn: " + extn + " | xyzMimeType: " + >> xyzMimeType); >> } >> } >> >> The MIME-type returned by this API is NULL although it correctly >> returns the extension (extn = "xyz"). >> >> So in my main application, if I skip the <data android:mimeType="..." >> /> line in the manifest file, the application does not receive the >> intent which means it is not launched. >> And there seems to be no way to specify android:mimeType as NULL. >> >> I also tried using <data android:mimeType="*" />, but with that, I get >> an error saying "Malformed XML". >> (Read about it here: >> >> http://stackoverflow.com/questions/1733195/android-intent-filter-for-a-particular-file-extension) >> >> Could someone please throw some light on this? >> >> Thanks, >> -Varun >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

