Removing an app icon from launcher

Creating an application that does not appear among the launchable applications with an icon is easy.
Just do not put a launcher activity into AndroidManifest.xml
- <intent-filter>
- <action android:name="android.intent.action.MA
IN" /> - <category android:name="android.intent.category.
LAUNCHER" /> - </intent-filter>
Removing an application icon after installation programatically is a bit more tricky.
You can not disable the icon itself, but you can disable one component of an application. So disabling the applications launcher activity will result its icon to be removed from launcher.
The code to do this is simple:
- ComponentName componentToDisable =
- new ComponentName("com.helloandroid.apptodi
sable", - "com.helloandroid.apptodi
sable.LauncherActivity"); - getPackageManager().setComponentEnabledSetting(
- componentToDisable,
- PackageManager.COMPONENT_ENABLED_STATE_DISABL
ED, - PackageManager.DONT_KILL_APP);
There is a few things to know about this solution:
- the disabled component will not be launchable in any way
- other non disabled activities will be launchable from other applications
- an application can only disable its own component. There is a permission "android.permission.CHANGE_COM
PONENT_ENABLED_STATE", but it wont work, 3rd party applications can not have this permission - the icon will only disapper when the launcher is restarted, so likely on next phone reboot, forcing the launcher to restart is not recommended
New tutorials from Helloandroid
Recent Apps
Android on Twitter
-
@StephanieNich10 (Stephanie Nichols)#android I laughed so hard at ochocinco 's avi. Hahahaha http://t.co/MPuhhi3m
29 weeks 5 days ago -
@CarlaAtkins8 (Carla Atkins)#android Omg! This is actually f'n interesting http://t.co/JodMOehr
29 weeks 5 days ago -
@MarianMcleod12 (Marian Mcleod)#android Precisely what song is? http://t.co/YmJXU0rB
29 weeks 5 days ago -
@JoBeach15 (Jo Beach)#android haha this made me laugh, i love ted:-) http://t.co/gtcWQ79C
29 weeks 5 days ago -
@aochart3 (青ちゃ)Start playing Paradise Island on Android http://t.co/DEID0Ao5 #Android #Androidgames #Gameinsight http://t.co/e1bifSeL
29 weeks 5 days ago
Poll
Useful resources
Android Development Projects
- Android app minor changes by naz89
- Ipad iphone property app by derickscott66
- Need a voice Dialer as soon as possible for (Andriod App) - repost 7 by desiredproject7
- Mobile app with form by suselarun
- Buy Android App Source Code: Games, Apps - repost by nsinatural
- game creation and design by muneerbadat123
- AI - Artificial representation of Will Sasso by Davidhsummer
- Convert Android app to iOS by jveilleux
- fromUztoKr by azizkhuja
- Skilled Android iOS Developer for Social invite app by vengorash



