我可以在以下链接的帮助下通过代码 重置默认启动器如何重置默认启动器/主屏幕替换?
现在,我想将我的自定义启动器设置为默认启动器。但是下面的代码不起作用。它崩溃了
ComponentName componentName = new ComponentName("com.xxx.launcher", "com.xxx.launcher.LauncheActivity");
PackageManager pm = getPackageManager();
int flag = ((pm.getComponentEnabledSetting(componentName) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED
: PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
pm.setComponentEnabledSetting(componentName, flag, PackageManager.DONT_KILL_APP); //crash at this line..