Hide application icon

前端 未结 5 1792
广开言路
广开言路 2020-12-01 02:58

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 the

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-01 03:53

    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).

提交回复
热议问题