0

After browsing the web I have found out that this code is supposed to start a app when docked:

 <intent-filter >
           <action android:name="android.intent.action.MAIN" />
           <category   android:name="android.intent.category.LAUNCHER" /> 
           <category android:name="android.intent.category.CAR_DOCK" />
           <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

The problem is that this does not start the app when the phone is docked. What am I doing wrong?

Edit: Nothing happens when I dock it in a desk dock.

cjds
  • 8,268
  • 10
  • 49
  • 84
Magakahn
  • 498
  • 9
  • 31

1 Answers1

0

"Nothing happens when I dock it in a desk dock."

Note the code you have written will only work for a car dock. Hence you have added the word car dock in the category.

To launch an app when in any Dock the following is required

<intent-filter >
       <action android:name="android.intent.action.MAIN" />
       <category   android:name="android.intent.category.LAUNCHER" /> 
       <category android:name="android.intent.category.DESK_DOCK" />
       <category android:name="android.intent.category.CAR_DOCK" />
       <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>

Note the addition of desk dock

cjds
  • 8,268
  • 10
  • 49
  • 84