修改app的默认设置(包括修改默认launcher)

1、改为自己的launcher

ComponentName component = new ComponentName(
context.getPackageName(), MainActivity.class.getName());//红色为自己的launcher入口
ComponentName[] components = new ComponentName[] {
new ComponentName("com.android.launcher",
"com.android.launcher2.Launcher"), component };
pm.clearPackagePreferredActivities("com.android.launcher");//清除默认launcher
pm.addPreferredActivity(filter, IntentFilter.MATCH_CATEGORY_EMPTY,
components, component);

2、改为系统的launcher


ComponentName component = new ComponentName("com.android.launcher",
"com.android.launcher2.Launcher");
ComponentName[] components = new ComponentName[] {
new ComponentName(context.getPackageName(), MainActivity.class.getName()), component };
pm.clearPackagePreferredActivities("com.android.launcher");
pm.addPreferredActivity(filter, IntentFilter.MATCH_CATEGORY_EMPTY,
components, component);


3、参考资料

http://blog.csdn.net/wh_19910525/article/details/39025425

http://blog.csdn.net/lwyygydx/article/details/42873829

http://www.07net01.com/2014/09/79947.html

http://blog.csdn.net/jia4525036/article/details/18036765


你可能感兴趣的:(android)