You can achieve this using Packagemanager setComponentEnabledSetting method.
Start by creating an Android application with one Activity and Broadcast Receiver; yes Broadcast Receiver will see how to use it to launch the hidden application.
In your main Activity add some UI to display to user and implement code for hidding application launcher icon.
Main Activity will look like
So what we have done is we have setup UI as per client’s requirement and created a method hideAppLauncher which we are calling from Activity’s onCreate() method itself. So what will happen, moment employee closes the application, they won’t be able to see the application launcher icon nor application will be killed which we defined using PackageManager. DONT_KILL_APP flag of packagemanager setComponentEnabledSetting method.
Now if we wish to launch this application using we do not have any launcher icon. So to open we will implement a Broadcast Receiver for handling outgoing calls. So if user dials a particular number let’s say *00009999#, Broadcast Receiver will launcher unhide application launcher icon and then launch the application. So in Broadcast Receiver add below code
After adding MainActivity and AppBroadcastReceiver details to AndroidManifest with required permission, Manifest will look like:-
Remember unhiding application launcher icon is required else your will get ActivityNotFound exception.
Also another import thing to note here is while launching application from Broadcast Receiver don’t forget to setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), to Activity launcher Intent. So that’s all, try running the application and check yourself.
Hope this article will help you in How to Hide Application Launcher Icon in Android. Android application Development experts are here to assist you, ask them your doubts about the subject.