Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide android application icon after install

Tags:

android

I've seen that there are some GPS application on Google apps where, after installation, the application will have no icon display yet will run services in the background.

How would I achieve this?

like image 919
user1865039 Avatar asked Dec 05 '12 02:12

user1865039


1 Answers

For removing Application from Launcher just do not put these lines with main Activity in AndroidManifest.xml

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

and if you want to remove it programatically then use PackageManager.setComponentEnabledSetting for removing it from the Launcher as :

  ComponentName componentToDisable =
  new ComponentName("com.xxx.apptodisable",
  "com.xxx.apptodisable.LauncherActivity");

  getPackageManager().setComponentEnabledSetting(
  componentToDisable,
  PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
  PackageManager.DONT_KILL_APP);
like image 197
ρяσѕρєя K Avatar answered Oct 25 '22 06:10

ρяσѕρєя K