Hide/Unhide Android App Icon

Babak Mahmoodizadeh
3 min readJul 14, 2021


Hey Folks! Today I’m gonna talk about the Hiding/Unhiding android app icon in code.

Why we should hide the android app icon then?

Photo by Juan Rumimpunu on Unsplash

It actually depends on your case there are some cases that you might wanna implement this feature for your android application.

  • you are developing an app which has some security concern
  • your app needs to be disappeared for some privacy concerns
  • Evil things (Joking, don’t do that. it really sucks 😆)

here I’m gonna create a sample application with a single button to hide the app icon.

Let’s dive into code

for sake of simplicity I’ll write all logic in “button.OnclickListener” in MainActivity.

let’s get started with our simple layout with just a simple button:

Snippet code for hiding application icon in MainActivity.kt:

  • packageManager: as you might already know this Class is for retrieving various kinds of information related to the application packages that are currently installed on the device. You can find this class through Context#getPackageManager.
  • CompoenetName: Identifier for a specific application component (Activity, Service, BroadcastReceiver, or ContentProvider) that is available. Two pieces of information, encapsulated here, are required to identify a component: the package (a String) it exists in, and the class (a String) name inside of that package.
  • packageManager.setCompoenetEnablesSetting: Set the enabled setting for a package component (activity, receiver, service, provider). This setting will override any enabled state which may have been set by the component in its manifest.

let’s briefly talk about some arguments that we passed:

Alright as you might already understand we just disabled our component (Launcher Activity) explicitly to hide the app icon.

Here is the result after clicking on the button (take a look at “sample app” at the bottom of the app list to see the magic :))) ) :

All done!

Photo by OSPAN ALI on Unsplash

But, Wait! how do we Unhide App icon then?

well, the good news is: you can unhide the app icon.

there’re some approaches about it that you might consider, however, these solutions might have something to do with some IPC things!

  • Registering broadcast event to unhide the app icon
  • Listening for push notifications
  • Alarm manager
  • Long-running bounded service
  • Any other innovative ways :)

My solution: Registering broadcast event

Let’s get into it:

Scenario: I’m gonna register the event for an outgoing call, which means the application would hopefully unhide the app icon when an outgoing call has been made.

Note: Don’t forget to request runtime permission “READ_PHONE_STATE”

Let’s register implicit receiver:

And the receiver class would be:

now, let’s test the app :)

There it is 😉

github: github.com/babakmhz/

twitter: twitter.com/babakmhz/