Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Category Home and Category Launcher

I am not clear about what is the difference between category home and category launcher. From Android documentation page:

CATEGORY_HOME : This is the home activity, that is the first activity that is displayed when the device boots.

CATEGORY_LAUNCHER : Should be displayed in the top-level launcher.

To test the difference I made a simple app with this manifest:

 <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".IntentCategoriesActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
        <activity
            android:name=".Second"
            android:label="Whatever" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.HOME" />
            </intent-filter>

        </activity>

    </application>

But all I see is my launcher activity not the second activity.

Can somebody please explain what am I missing? Thanks.

like image 858
Ian McGrath Avatar asked May 08 '12 02:05

Ian McGrath


People also ask

What is category launcher?

category -- Gives additional information about the action to execute. For example, CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level application, while CATEGORY_ALTERNATIVE means it should be included in a list of alternative actions the user can perform on a piece of data.

What is category in Android?

The way I understand it, categories are public directives to the android operating system(and other apps) that represent different categories that your app should be a part of. Example.

What is category in intent?

Standard categories are defined in the Intent class as CATEGORY_name constants. The name assigned here can be derived from those constants by prefixing " android. intent. category. " to the name that follows CATEGORY_ . For example, the string value for CATEGORY_LAUNCHER is " android.

What is action and category in Android?

action : Declares the intent action accepted, in the name attribute. The value must be the literal string value of an action, not the class constant. category: Declares the intent category accepted, in the name attribute.


2 Answers

android.intent.category.HOME is used for Home Screen activities like ADW Launcher, Launcher Pro, etc. If you want to create a new home screen use this.

android.intent.category.LAUNCHER is used to specify which of your activities can be launched. I.e. which ones show up in the app drawer.

like image 169
slayton Avatar answered Oct 05 '22 18:10

slayton


android.intent.category.HOME - To be a launcher - this activity is homescreen android.intent.category.LAUNCHER - To be in launcher - this activity is visible in menu

like image 26
Honza Avatar answered Oct 05 '22 18:10

Honza