title: Android: change default Home Application
body: <p>for some specific requirement
  I am required to change Android Default Home application
  with my customized Home application ( a setting inside my app that will toggle default home = my application or previous home)</p>
  
  <p>I don't want the user to travel android settings that are very complicated.</p>
  
  <p>Can any one help me out like where it registers launcher.apk for default
  home application or how to change that</p>
  
  <p>The only thing I could find was that old question: <a href="https://stackoverflow.com/questions/3204369/how-to-change-default-android-desktop-application">How to change default Android&#39;s Desktop application?</a></p>
  
  <p>but no answers at all.</p>
  
  <p>I have seen HomeSwitcher in the Market that do the trick, but no answer for the developer that might certainly be busy.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I found this on the web <a href="http://www.mail-archive.com/android-developers@googlegroups.com/msg74167.html" rel="nofollow noreferrer">http://www.mail-archive.com/android-developers@googlegroups.com/msg74167.html</a></p>
  
  <p>But I got the same issue:</p>
  
  <p>this is my code:</p>
  
  <pre><code>    private void makePreferred() {
              PackageManager pm = getPackageManager();
              IntentFilter f = new IntentFilter("android.intent.action.MAIN");
              f.addCategory("android.intent.category.HOME");
              f.addCategory("android.intent.category.DEFAULT");
              ComponentName cn = new ComponentName("com.example.android.home", "com.example.android.home.Home");
              pm.addPreferredActivity(f, IntentFilter.MATCH_CATEGORY_EMPTY, null, cn);
  </code></pre>
  
  <p>I have the <code>android.permission.SET_PREFERRED_APPLICATIONS</code> set in the
  manifest. After executing the code above, the logs claim things have
  been added like expected (same logs as when I tick off "Make default"
  from IntentResolver's list). However, when I proceed by clicking home,
  the list still shows up and the logs say:</p>
  
  <pre><code>INFO/PackageManager(52): Result set changed, dropping preferred
  activity for Intent { act=android.intent.action.MAIN cat=
  [android.intent.category.HOME] flg=0x10200000 } type null
  </code></pre>
  
  <p>So it seems the resolver deletes the default entry. Am I doing
  something wrong, or is this a security measure? What are the ideas
  behind this?</p>