5

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?

Community
  • 1
  • 1
Aerik
  • 2,307
  • 1
  • 27
  • 39
  • Lots of interesting info in the linked post, but the summary of it is you can't since this was fixed in Froyo (2.2) and Home Switcher also notes that it can not be used in 2.2+. – kabuko Oct 12 '12 at 19:10
  • What do you think about (a slightly different question / solution) creating a launcher app that *is* the default, and it launches other launchers? – Aerik Oct 12 '12 at 19:49
  • Give it a shot. This is definitely the route I'd try first if I were to do something like this. I don't see why it wouldn't work. You should certainly be able to find the list of valid launcher intents, and pick one to start. – kabuko Oct 12 '12 at 19:54

1 Answers1

8

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 2
    If you look on the permissions page for that app it has: **System tools** _set preferred apps_ Allows the app to modify your preferred apps. Malicious apps may silently change the apps that are run, spoofing your existing apps to collect private data from you. – kabuko Oct 12 '12 at 19:04
  • @kabuko: Last I checked, though, the only things that permission protected were disabled in the SDK. – CommonsWare Oct 12 '12 at 19:06
  • Yeah, I don't actually know. I just figured I'd point out that permission as it seemed relevant. – kabuko Oct 12 '12 at 19:07
  • @CommonsWare any document for rooted device or By adding system app we can do..please suggest – Gowthaman M Aug 26 '20 at 11:49
  • @GowthamanM: I do not have any such documentation. On the whole, Stack Overflow tends to be more for mainstream app development issues, not those pertaining to root or system apps. – CommonsWare Aug 26 '20 at 11:55
  • @CommonsWare Could you please help which portal i can rise this question..i am android AOSP developer,,I am creating system launcher application part of system apps... – Gowthaman M Aug 26 '20 at 12:02
  • @GowthamanM: XDA's forums and reddit would be two possibilities. – CommonsWare Aug 26 '20 at 12:06
  • @CommonsWare is there a way to do it using the "Device admin" permissions? https://developer.android.com/guide/topics/admin/device-admin Cus, other apps like Mobilock or Scalefusion seem to be able to do that. – Mena Feb 23 '21 at 13:44
  • @Mena: I doubt that device *admin* can do that. Device *owner* might, but I have not worked with those APIs to date. – CommonsWare Feb 23 '21 at 14:04