android.intent.category.DEFAULT - what is its purpose?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

android.intent.category.DEFAULT - what is its purpose?

Postby DaveInNYC » Fri Nov 13, 2009 1:38 am

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:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <intent-filter>
  3.  
  4.        <action android:name="android.intent.action.MAIN" />
  5.  
  6.         <category android:name="android.intent.category.CAR_DOCK" />
  7.  
  8.          <category android:name="android.intent.category.DEFAULT" />
  9.  
  10. </intent-filter>
  11.  
  12.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


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?
DaveInNYC
Freshman
Freshman
 
Posts: 2
Joined: Fri Nov 13, 2009 1:32 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests