Take the 2-minute tour ×

I am doing an Android application. I want to hide the application icon in the emulator and I want to start my application by pressing some numbers, for instance 456#. Is there a way to do this?

share|improve this question
Can you little bit elaborate more?? Where you stuck at, making application run in Background or detecting key code? Or both?? –  Prasham Dec 6 '11 at 12:46
add comment

5 Answers

To Hide app icon from launcher programatically you can do this

    PackageManager packageManager = context.getPackageManager();
    ComponentName componentName = new ComponentName(context,
    packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED,

To launch app by pressing number first add folowing permission in mainfest file

     <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>

Then register receiver

<receiver android:name=".LaunchAppViaDialReceiver"> 
    <action android:name="android.intent.action.NEW_OUTGOING_CALL"/>

Then create a receiver class

  public class LaunchAppViaDialReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
    Bundle bundle = intent.getExtras();
    if (null == bundle)
    String phoneNubmer = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
             //here change the number to your desired number
    if (phoneNubmer.equals("12345")) {
        Intent appIntent = new Intent(context, LauncherActivity.class);

share|improve this answer
your code is so help full but i have a problem my app icon is still visible the only way it vanishes away is to restart the phone.. is there a to refresh the menu –  Areeb Gillani Sep 26 '13 at 19:32
add comment

The answer to the first part of your question, try this code:

PackageManager pm = getApplicationContext().getPackageManager(); 
pm.setComponentEnabledSetting(getComponentName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

Your application will not be visible, but the user can still find it in the Settings >> Applications >> Manage Application

This answer may also be helpful for you.

Please do not forget to post your answer here, if you have already achieved the functionality(pressing some number & opening our application).

share|improve this answer
I tried the code you listed on an phone with Android 2.21. Although it did not hide the app icon in the drawer, it did something. Now when I click on the icon, it says "Application is not installed on your phone". Thanks. –  timeon Jun 27 '12 at 15:59
add comment

I am not sure how you can hide app icon, but I`d propose you using service in some background application that will interpret the numbers you insert. For me this is the fastest way to achieve it. So, you should have to make two apps instead of one.

Read this if you want to know more: http://developer.android.com/guide/topics/fundamentals/services.html

share|improve this answer
@sebap123..thanks.....But i need a solution....some says for hiding icon remove launcher from manifest ....but i want to start my app by entering some combination from my keypad....eg:123# –  sarath Dec 7 '11 at 6:42
add comment

Note that the solution:

PackageManager pm = getApplicationContext().getPackageManager(); 
pm.setComponentEnabledSetting(getComponentName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

will make the app NOT upgradeable from google play as the OS will not find the package after this component disabling and will not able to re-install it, unless the app is not manullay uninstalled (which is not a user friendly behaviour)

share|improve this answer
add comment

Guy, You can try to implementing new funcionaties on "onPause() or onStop()" when your app sleep, it calls that methods.


share|improve this answer
..i didn't get your point....Did you understand my problem...? –  sarath Dec 6 '11 at 11:25
add comment

Your Answer


