How do I programmatically set the default launcher app? [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 10:17:12

问题


Possible Duplicate:
Android: change default Home Application

I want to create a program like "Home Switcher" that can programmatically set the default launcher. I have no code written yet but can kind of figure out how to find the available launcher apps, but I have no idea how to programmatically set the default. Can anyone point me in the right direction?


回答1:


This is not possible, except perhaps via some security flaw. I will look into it and try to get this flaw fixed, assuming that this app actually works.

Rooted devices should be able to do this, but not unrooted ones.


UPDATE

These apps do not actually set the default home, near as I can tell. They are simply calling startActivity() with a MAIN/LAUNCHER Intent, using createChooser() to force a chooser dialog to appear, giving the user the opportunity to choose a home screen and make it the default. This is perfectly legitimate, as it requires user involvement in the process.

Leastways, three of them work this way, while one simply crashes when trying to set a home screen.



来源:https://stackoverflow.com/questions/12865367/how-do-i-programmatically-set-the-default-launcher-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!