Purpose of using CATEGORY_HOME in android manifest?

What is the alternative to uninstalling from AndroidManifest:

<activity android:name="com.apper.main.UserActivity" android:label="@string/app_name" android:launchMode="singleTask" android:clearTaskOnLaunch="true" android:stateNotNeeded="true" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.HOME"/> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 

I also found that after deleting the above line there was no effect on my android expression. What is the main use of this category and what is the alternative to it.

If the goal of this category is to launch the main screen, then this can be done as follows:

 Intent homeIntent= new Intent(Intent.ACTION_MAIN); homeIntent.addCategory(Intent.CATEGORY_HOME); homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(homeIntent); 

This code above launches the main screen, but why the line in the android manifest? What is the purpose of removing the line from here does not change the application?

+4
source share
2 answers

What is the main use of this category

It, together with ACTION_MAIN , identifies the initial replacement screen.

what is the alternative to him

Not having this. Either you have this category or not.

+5
source

The HOME category is used to declare your application as a Home launcher. By placing this in the manifest, the user will be able to open your application when you click the home button.

This is usually used when creating an application that will be used in kiosk mode.

I do not believe that there is an alternative to making the application a home program.

Documentation

+3
source

Source: https://habr.com/ru/post/1490522/


All Articles