You can also register file extensions in your manifest intent-filter. Something like this worked in one of my applications:
<intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="http" android:host="*" android:pathPattern=".* \\.xyz"/> <data android:scheme="https" android:host="*" android:pathPattern=".*\\.xyz"/> <data android:scheme="content" android:host="*" android:pathPattern=".*\\.xyz"/> <data android:scheme="file" android:host="*" android:pathPattern=".*\\.xyz"/> </intent-filter> On Jan 29, 10:37 am, Brion Emde <brione2...@gmail.com> wrote: > I don't know if this is what you want, but look at the intent-filter > stuff here: > > http://developer.android.com/intl/de/guide/topics/intents/intents-fil... > > I have an intent-filter defined that will cause the browser to > recognize a Uri of the form "bloa-app://twitt" and send requests to > that Uri to my app. I did this by adding this to the Activity's > description in AndroidManifest.xml: > > <intent-filter> > <action > android:name="android.intent.action.VIEW" /> > <category > android:name="android.intent.category.DEFAULT" /> > <category > android:name="android.intent.category.BROWSABLE" /> > <data android:scheme="bloa-app" > android:host="twitt" /> > </intent-filter> > > Good luck finding your answer. > > On Jan 29, 6:38 am, Varun Khaneja <khan...@gmail.com> wrote: > > > > > 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 <hack...@android.com> > > 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 <khan...@gmail.com> 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-...) > > > >> 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 android-developers@googlegroups.com > > >> To unsubscribe from this group, send email to > > >> android-developers+unsubscr...@googlegroups.com > > >> For more options, visit this group at > > >>http://groups.google.com/group/android-developers?hl=en > > > > -- > > > Dianne Hackborn > > > Android framework engineer > > > hack...@android.com > > > > 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 android-developers@googlegroups.com > > > To unsubscribe from this group, send email to > > > android-developers+unsubscr...@googlegroups.com > > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en