且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

机器人如何以编程方式隐藏启动图标

更新时间:2023-11-19 11:03:28

  PackageManager P = getPackageManager();
p.setComponentEnabledSetting(getComponentName(),PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
 

请注意,该图标可能不会消失,直到下次重新启动。

my app is designed to only need to be run once. As such I want to hide the icon from the launcher after the first run, but without uninstalling the app.

I have seen similar applications - they can remove their own icons from the launcher app list. How can I achieve the same results? Thank you.

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

Note that the icon may not be gone until the next reboot.