This is easily found in the documentation: http://developer.android.com/reference/android/content/Intent.html
This came directly from the above link: "The *categories*, if supplied, must *all* be listed by the activity as categories it handles. That is, if you include the categories CATEGORY_LAUNCHER<http://developer.android.com/reference/android/content/Intent.html#CATEGORY_LAUNCHER>and CATEGORY_ALTERNATIVE<http://developer.android.com/reference/android/content/Intent.html#CATEGORY_ALTERNATIVE>, then you will only resolve to components with an intent that lists *both* of those categories. Activities will very often need to support the CATEGORY_DEFAULT<http://developer.android.com/reference/android/content/Intent.html#CATEGORY_DEFAULT>so that they can be found by Context.startActivity()<http://developer.android.com/reference/android/content/Context.html#startActivity%28android.content.Intent%29> ." And later from in the same document: "Note also the DEFAULT category supplied here: this is *required* for the Context.startActivity<http://developer.android.com/reference/android/content/Context.html#startActivity%28android.content.Intent%29>method to resolve your activity when its component name is not explicitly specified." Hope this helps clear things up a bit. Intents and intent filters can be a little confusing at first. Thanks, Justin ---------------------------------------------------------------------- There are only 10 types of people in the world... Those who know binary and those who don't. ---------------------------------------------------------------------- On Fri, Nov 13, 2009 at 5:41 PM, DaveInNYC <[email protected]> wrote: > I am not entirely clear on when one should use > android.intent.category.DEFAULT in their intent filter. Most of the > examples I have seen use it without explaining why. > > In my particular case, I am trying to have my app launch when the > device is placed in the car dock. However, it would not launch until I > added the default category: > > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category android:name="android.intent.category.CAR_DOCK" /> > <category android:name="android.intent.category.DEFAULT" /> > </intent-filter> > > Now here is the strange part: when I call getIntent() in my activity, > the only category it contains is android.intent.category.CAR_DOCK. I > thought that a particular category needed to be in an intent filter > only if that category was in the intent that was broadcast, but in > this case the default category was NOT in the intent, yet it still > seems to be required. What am I missing? > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-beginners%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en

